-
andersonsalas CodeIgniter enthusiast
 
-
Posts: 10
Threads: 5
Joined: Jun 2015
Reputation:
0
04-17-2018, 09:52 PM
(This post was last modified: 05-13-2018, 07:03 PM by andersonsalas.)
Hi!
I want to share my recently rewritten project: it's called Luthier-CI.
What is Luthier-CI?
Luthier-CI is a CodeIgniter plugin that enables Laravel-like routing and introduces the concept of Middleware in our applications.
Key features
- Clean and easy installation via hooks
- Global and per-route middleware
- Advanced routing: prefixes, namespaces, anonymous functions as routes, route groups, cli routes, named parameters, optional parameters, sticky parameters
With Luthier-CI we can, for example, write this:
PHP Code: Route::group('catalog', function(){ Route::get('cars/{category_id}/{filter_by?}', 'CarsController@catalog'); Route::match(['get','post'], 'bikes/{category_id}/{filter_by?}', 'BikesController@catalog'); Route::get('airplanes/{category_id}/{filter_by?}', 'AirplanesController@catalog'); });
Route::post('this/is/a/{very?}/{large?}/{route?}/{example?}', 'TestController@foo');
Instead this:
PHP Code: $route['catalog/cars/(:any)']['GET'] = 'CarsController/catalog/$1'; $route['catalog/cars/(:any)/(:any)']['GET'] = 'CarsController/catalog/$1/$2'; $route['catalog/bikes/(:any)']['GET'] = 'BikesController/catalog/$1'; $route['catalog/bikes/(:any)']['POST'] = 'BikesController/catalog/$1'; $route['catalog/bikes/(:any)/(:any)']['GET'] = 'BikesController/catalog/$1/$2'; $route['catalog/bikes/(:any)/(:any)']['POST'] = 'BikesController/catalog/$1/$2'; $route['catalog/airplanes/(:any)']['GET'] = 'AirplanesController/catalog/$1/$2'; $route['catalog/airplanes/(:any)/(:any)']['GET'] = 'AirplanesController/catalog/$1/$2'; $route['this/is/a']['GET'] = 'TestController/foo'; $route['this/is/a/(:any)']['POST'] = 'TestController/foo/$1'; $route['this/is/a/(:any)/(:any)']['POST'] = 'TestController/foo/$1/$2'; $route['this/is/a/(:any)/(:any)/(:any)']['POST'] = 'TestController/foo/$1/$2/$3'; $route['this/is/a/(:any)/(:any)/(:any)/(:any)']['POST'] = 'TestController/foo/$1/$2/$3/$4';
... or use an anonymous function instead a controller:
PHP Code: Route::get('test', function(){ echo 'Hello world!'; });
... or even perform the same action with all routes using a middleware:
PHP Code: Route::middleware(function(){ echo 'This will be executed on every route below!'; }, 'pre_controller');
Route::group('foo', function(){ Route::get('bar', function(){ echo 'Test'; }); Route::get('baz', function(){ echo 'Test 2'; }, ['middleware' => ['Auth']]); # Only this route will run the 'Auth' middleware! });
More information (Documentation, installation instructions, etc.)
View Luthier-CI on GitHub
It is a somewhat complex project so any suggestion, opinion, or even donation is welcome!
Tested in PHP 5/7 and CodeIgniter 3.1.7 / 3.1.8 (apparently everything works  )
-
andersonsalas CodeIgniter enthusiast
 
-
Posts: 10
Threads: 5
Joined: Jun 2015
Reputation:
0
[Update 13-05-2018]
The 0.2.1 version was released recently. Improvements accumulated to date:
- Full CLI routing support: laravel-like syntax now works with CLI commands, and a few built-in CLI commands are available to use (controller creation, migration wizard, etc.)
- Better late than never, but we published an official project website with more detailed documentation and examples:Luthier-CI documentation
More features on the way
-
Krycek A noaber
 
-
Posts: 45
Threads: 6
Joined: Feb 2015
Reputation:
0
-
andersonsalas CodeIgniter enthusiast
 
-
Posts: 10
Threads: 5
Joined: Jun 2015
Reputation:
0
06-25-2018, 01:10 PM
[Update 25-06-2018]
Version 0.3.0 Released! it comes with new features:
- Built-in auth system: now you can easily implement an user login/signup in your application thanks to SimpleAuth, a cool ready-to-use authentication template. For advanced users is also available the Luthier CI Authentication Framework, a structure to build authentication systems from scratch.
- PHP Debug Bar integration (experimental) : a basic integration with this debug tool was added, and now you can log variables, expressions, database queries, and handle with custom data collectors.
Screenshots:
SimpleAuth default login screen
PHP Debug Bar integration
Thanks for your comments, we appreciate all of them
Github: Luthier CI
Documentation: Luthier CI Documentation
-
jvandemerwe Junior Member
 
-
Posts: 12
Threads: 1
Joined: Jan 2015
Reputation:
0
02-03-2019, 03:11 AM
I am trying to work with Luthier-CI and I must say that I really like the routing part. I have a question about the middleware part.
How do I pass variables to a route? I'd like to see something possible like:
Code: Route::get('toystory/woody/{category_id}', 'moviesController@cast', [
'middleware' => [
'Input' => [
'search' => false,
'userId' => [],
'language' => 'DE',
'age' => [
'sanitizer' => FILTER_SANITIZE_NUMBER_INT,
'default' => 23
],
'start' => 0,
'limit' => 50
]
]
]);
But I don't want to have the arguments in the controller. So my question is, is this possible?
When I do it like above I get always the message: "Unable to find .php in your application/middleware folder".
-
takielias Newbie

-
Posts: 9
Threads: 3
Joined: Dec 2019
Reputation:
-1
|