{"id":13677112,"url":"https://github.com/ingeniasoftware/luthier-ci","last_synced_at":"2025-04-05T07:04:01.161Z","repository":{"id":44994619,"uuid":"78362985","full_name":"ingeniasoftware/luthier-ci","owner":"ingeniasoftware","description":"Improved routing, middleware support, authentication tools and more for CodeIgniter 3 framework","archived":false,"fork":false,"pushed_at":"2021-10-23T12:06:12.000Z","size":471,"stargazers_count":149,"open_issues_count":8,"forks_count":36,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-03-15T10:50:23.739Z","etag":null,"topics":["codeigniter","codeigniter-framework","luthier-ci","php","router"],"latest_commit_sha":null,"homepage":"https://luthier.ingenia.me/ci/en/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ingeniasoftware.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-08T18:42:50.000Z","updated_at":"2023-12-21T10:39:41.000Z","dependencies_parsed_at":"2022-09-22T15:40:22.402Z","dependency_job_id":null,"html_url":"https://github.com/ingeniasoftware/luthier-ci","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingeniasoftware%2Fluthier-ci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingeniasoftware%2Fluthier-ci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingeniasoftware%2Fluthier-ci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingeniasoftware%2Fluthier-ci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ingeniasoftware","download_url":"https://codeload.github.com/ingeniasoftware/luthier-ci/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299831,"owners_count":20916190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeigniter","codeigniter-framework","luthier-ci","php","router"],"created_at":"2024-08-02T13:00:37.087Z","updated_at":"2025-04-05T07:04:01.128Z","avatar_url":"https://github.com/ingeniasoftware.png","language":"PHP","readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://ingenia.me/images/LuthierCILogo.png\" width=\"100\" /\u003e\n\u003c/p\u003e\n\n**Luthier CI** is an awesome set of core improvements for CodeIgniter 3 that makes the development of APIs (and websites in general) more easy!\n\n## Features\n\n* Easy installation via hooks\n* Laravel-like routing: prefixes, namespaces, anonymous functions as routes, route groups, CLI routes, named parameters, optional parameters, etc.\n* Middleware support \n* Authentication library with SimpleAuth template\n* PHP Debug Bar integration (experimental)\n\n## Requirements\n\n* PHP \u003e= 5.6.0 (PHP 7 compatible)\n* CodeIgniter \u003e= 3.0\n\n## Installation\n\n#### Step 1: Get Luthier CI with Composer\n\n```\ncomposer require luthier/luthier\n```\n\n#### Step 2: Enable Hooks and Composer autoload\n\n```php\n\u003c?php\n# application/config/config.php\n\n$config['enable_hooks'] = TRUE;\n$config['composer_autoload'] = TRUE;\n```\n\n#### Step 3: Connect Luthier CI with CodeIgniter\n\nSet the hooks:\n\n```php\n\u003c?php\n# application/config/hooks.php\n\ndefined('BASEPATH') OR exit('No direct script access allowed');\n\n// (...)\n\n$hook = Luthier\\Hook::getHooks();\n```\n\nSet the Luthier CI routes:\n\n```php\n\u003c?php\n# application/config/routes.php\n\ndefined('BASEPATH') OR exit('No direct script access allowed');\n\n// (...)\n\n$route = Luthier\\Route::getRoutes();\n```\n\n## Initialization\n\nThe first time that Luthier CI runs, several files and folders are created:\n\n* `routes/web.php`: Default HTTP-Based routes\n* `routes/api.php`: AJAX routes\n* `routes/cli.php`: CLI routes\n* `controllers/Luthier.php`: Fake controller, necessary to use some routes\n* `middleware`: Middleware folder\n\n**Important**: Make sure that your `application` folder has write permission!\n\n## Usage\n\nTo add routes, use the static methods of the `Route` class:\n\n```php\n\u003c?php\n# application/routes/web.php\n\n// This points to 'baz' method of 'bar' controller at '/foo' path under a GET request:\nRoute::get('foo', 'bar@baz');\n\n// To add a route parameter, enclose with curly brackets {}\nRoute::get('blog/{slug}', 'blog@post');\n\n// To make a parameter optional, add a ? just before closing the curly brackets\n// (Luthier CI will make all the fallback routes for you)\nRoute::get('categories/{primary?}/{secondary?}/{filter?}', 'clients@list');\n\n// The (:any) and (:num) CodeIgniter route placeholders are available to use, with this syntax:\nRoute::get('cars/{num:id}/{any:registration}', 'CarCatalog@index');\n\n// Custom regex? it's possible with this syntax:\nRoute::post('main/{((es|en)):_locale}/about', 'about@index');\n```\n\nUse the `Route::cli()` method to add command line routes. All CLI routes must be inside `routes/cli.php` file. This is an example of a CLI route:\n\n```php\nRoute::cli('path','controller@method');\n```\n\nThe `ci()` function returns the framework instance, acting as a *virtual* controller. This is useful if you use callbacks as routes:\n\n```php\nRoute::get('foo', function(){\n    ci()-\u003eload-\u003eview('some_view');\n});\n```\n\nYou can assign names to your routes so you don't have to worry about future url changes:\n\n```php\nRoute::get('company/about_us', 'testcontroller@index')-\u003ename('about_us');\n```\n\nTo retrieve a named route, use the `route()` function:\n\n```php\n\u003ca href=\"\u003c?= route('about_us');?\u003e\"\u003eMy link!\u003c/a\u003e\n// \u003ca href=\"http://example.com/company/about_us\"\u003eLink\u003c/a\u003e\n```\n\nIf the route has parameters, pass a second argument to the function with an array of their values:\n\n```php\n\u003c?= route('route_name', ['param1' =\u003e 'value2', 'param2' =\u003e 'value2' ... ]); ?\u003e\n```\n\n#### Route Groups\n\nGroup routes is possible with the  `Route::group()` method. All routes\ninside the group will share the *prefix* (first argument) and, optionally, another property (*namespace*, *middleware*, etc.)\n\n```php\n// Prefix only\nRoute::group('prefix', function(){\n    Route::get('bar','test@bar');\n    Route::get('baz','test@baz');\n});\n\n// Prefix and shared properties\nRoute::group('prefix', ['namespace' =\u003e 'foo', 'middleware' =\u003e ['Admin','IPFilter']], function(){\n    Route::get('bar','test@bar');\n    Route::get('baz','test@baz');\n});\n```\n\n\n## Middleware\n\nAll the middleware must be defined in the routes files (`application/routes/web.php`, `application/routes/api.php`, `application/routes/cli.php`)\n\n```php\n# Route middleware:\nRoute::put('foo/bar','controller@method', ['middleware' =\u003e ['Test']]);\n\n# Route group middleware:\nRoute::group('site', ['middleware' =\u003e ['Admin']], function(){\n    // ...\n});\n\n# Global middleware:\nRoute::middleware('Admin', 'pre_controller');\n```\n\nThe middleware files must be saved in the `application/middleware` folder. If not exists, you must create it first. A middleware file is any php class that implements the `Luthier\\MiddlewareInterface` interface and with a public `run()` method, which is the entry point. It's strongly advised to name all your middleware with CamelCase and avoid name conflicts with your controllers.\n\nThis is an example of a middleware:\n\n```php\n\u003c?php\n# application/middleware/TestMiddleware.php\n\nclass TestMiddleware\n{\n    public function run()\n    {\n        // (Entry point)\n    }\n}\n```\n\n### Documentation\n\nVisit the project [official website](https://luthier.ingenia.me/ci/en/help) (disponible en [español](https://luthier.ingenia.me/ci/es/help))\n\n\n\n\n\n\n\n\n","funding_links":[],"categories":["PHP","Complex"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fingeniasoftware%2Fluthier-ci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fingeniasoftware%2Fluthier-ci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fingeniasoftware%2Fluthier-ci/lists"}