{"id":20519849,"url":"https://github.com/jabranr/lassi","last_synced_at":"2025-10-24T11:07:23.563Z","repository":{"id":56995342,"uuid":"43438510","full_name":"jabranr/lassi","owner":"jabranr","description":"PHP boilerplate for quick start projects using Slim Framework and Eloquent.","archived":false,"fork":false,"pushed_at":"2023-09-20T10:58:15.000Z","size":66,"stargazers_count":58,"open_issues_count":4,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-18T03:18:25.010Z","etag":null,"topics":["eloquent-database","php-boilerplate","slim-framework"],"latest_commit_sha":null,"homepage":"","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/jabranr.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-09-30T14:41:17.000Z","updated_at":"2024-07-06T13:30:31.000Z","dependencies_parsed_at":"2024-01-17T23:09:28.276Z","dependency_job_id":"88620aa3-a0cf-439f-b539-cf5cac5d2816","html_url":"https://github.com/jabranr/lassi","commit_stats":{"total_commits":43,"total_committers":4,"mean_commits":10.75,"dds":"0.34883720930232553","last_synced_commit":"c6776b339ab178a3fa6b62ef214996dacc97664c"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jabranr/lassi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Flassi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Flassi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Flassi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Flassi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jabranr","download_url":"https://codeload.github.com/jabranr/lassi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Flassi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266706642,"owners_count":23971904,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["eloquent-database","php-boilerplate","slim-framework"],"created_at":"2024-11-15T22:16:37.248Z","updated_at":"2025-10-24T11:07:18.540Z","avatar_url":"https://github.com/jabranr.png","language":"PHP","funding_links":[],"categories":["Packages and Middleware"],"sub_categories":["Videos"],"readme":"# Lassi (Not maintained anymore)\nPHP boilerplate for quick projects using Slim Framework and Eloquent database.\n\n![Lassi](https://cloud.githubusercontent.com/assets/2131246/10229125/66ff122e-686e-11e5-9351-d6e840c1917b.png)\n\nLassi is a small PHP boilerplate to use \u003ca href=\"http://www.slimframework.com/\" target=\"_blank\"\u003eSlim Framework\u003c/a\u003e with \u003ca href=\"https://github.com/illuminate/database\" target=\"_blank\"\u003eEloquent database\u003c/a\u003e components \u0026ndash; enabling you to quickly start building your PHP projects with an MVC design pattern and datastore in no time.\n\n\u003e Warnning: Project is in alpha status. For more see [issues tracker](https://github.com/jabranr/lassi/issues).\n\n# Installation and Setup\nInstall with [composer](http://getcomposer.org) `create-project` command. This will install Lassi and all of it's dependencies i.e. Slim Framework and Eloquent database.\n\n```shell\n$ composer create-project jabranr/lassi\n```\n\n#### Configuration\nLassi uses `.env` files to setup it's configuration. There is such sample file `.sample.env` packaged with it. Lassi will look for `.dev.env`, `.dist.env` or `.env` respectively at the run time or throws `NotFoundException`.\n\n#### Charset \u0026 Collation\nBy default `.sample.env` file has charset and collation configurations set to `UTF-8 mb4` to support various type of characters encoding. You can update it with your own choice, of course. For more on best encoding practices, read [Working with UTF-8 at PHP: The Right Way](http://www.phptherightway.com/#php_and_utf8).\n\n#### Routing\nUse the `routes.php` in root directory to setup routes. You would setup routes as you do in Slim Framework. Afterall it is using Slim Framework in background. For more on setting up routes, see [Slim Framework Documentation](http://docs.slimframework.com/routing/overview/).\n\n#### Structure\n**Controllers:** The Controllers are to be saved in `controller/` directory. All Controllers must extend `Lassi\\App\\Controller` base controller class and pass the `LassiLassi` instance to its constructor using `LassiLassi::getInstance()` method. You can also add relevant Model(s) using `useModel(string|array $model)` method. You can name the controller as you like but do keep up with best practices.\n\n**Models:** All relevant Models are saved in `model/` directory and must extend the `Illuminate\\Database\\Eloquent\\Model` class. You would use models as you do in Eloquent. For more on setting up models and use other options, see [Eloquent database quick start guide](https://github.com/illuminate/database).\n\nThere is an example controller and model in mentioned directories for you to get started with.\n\n**Views:** All views/templates are saved in `view/` directory.\n\n**Assets:** All assets are saved in `public/` directory.\n\n#### Example:\n\n**Create project**\n\nCreate a project using Composer `create-project` command and `cd` into project directory.\n```shell\n$ composer create-project jabranr/lassi\n$ cd path/to/lassi\n```\n\n**Update configuration**\n\nUpdate configurations as required in `.dev.env` file.\n\n**Start server**\n\nStart the PHP built-in server and navigate browser to `http://localhost:8000`.\n```shell\n$ php -S localhost:8000 -t public\n```\n\n**Setup routes**\n\n* Add `hello` route\n\nAdd a new route `hello` in `routes.php` and try it in browser by navigating to `http://localhost:8000/hello`\n```php\n$app-\u003eget('/hello', function() use ($app) {\n\t$app-\u003eresponse-\u003ewrite('Hello World');\n});\n```\n\n* Add `goodbye` route\n\nAdd a new route `goodbye` in `routes.php` to render a template. Create a new file `goodbye.php` with basic HTML and save in `/view` directory.\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\t\u003chead\u003e\n\t\t\u003ctitle\u003eLassi goodbye template\u003c/title\u003e\n\t\u003c/head\u003e\n\t\u003cbody\u003e\n\t\t\u003ch1\u003eGoodbye!\u003c/h1\u003e\n\t\u003c/body\u003e\n\u003c/html\u003e\n```\n\nCall this template to render directly from a route's definition or by using a `Controller`.\n\n**Directly from a route's definition**\n\n```php\n$app-\u003eget('/goodbye', function() use ($app) {\n\treturn $app-\u003erender('goodbye.php');\n});\n```\n\n**Using a controller**\n\nAdd a new public method `goodbye()` to `WelcomeController.php` in `/controller` directory.\n\n```php\nclass WelcomeController extends Lassi\\App\\Controller {\n\t...\n\n\tpublic function goodbye() {\n\t\treturn $this-\u003eapp-\u003erender('goodbye.php');\n\t}\n}\n```\n\nModify the route's definition to use controller.\n\n```php\n$app-\u003eget('/goodbye', 'Lassi\\Controller\\WelcomeController:goodbye');\n```\n\nFor complete reference, see [Slim Framework documentation](http://docs.slimframework.com/)\n\n#### Using Eloquent\n\nTo setup any database connection fill in the required information in relevant `*.env` file.\n\n**Setup SQLite database**\n\nAt minimum it requires an absolute URL to SQLite file and `db_driver` value set to `sqlite`.\n\n```shell\ndb_driver\t = sqlite\t\t\t\t(Required)\ndb_name\t\t = path/to/foo.sqlite\t(Required)\ndb_prefix\t = lassi_\t\t\t\t(Optional)\n```\n\n**Setup MySQL, SQL, MSSQL or Sybase database**\n\n```shell\ndb_driver\t = mysql\t\t(Required)\ndb_host\t\t = localhost\t(Required)\ndb_name\t\t = lassi\t\t(Required)\ndb_username\t = root\t\t\t(Required)\ndb_password\t = p@ssword\t\t(Required)\ndb_prefix\t = lassi_\t\t(Optional)\n```\nUsing Eloquent is straight forward after a connection is established. To learn more on how to use Eloquent, see [Official Eloquent Documentation](http://laravel.com/docs/5.1/eloquent).\n\n**Create a table using Eloquent**\n\nYou can use the `Illuminate\\Database\\Capsule\\Manager::schema()` method to setup database migrations. Here is an example to create a `lassi_users` table.\n\n```php\nclass WelcomeController extends Lassi\\App\\Controller {\n\t...\n\n\tpublic function makeUserTable() {\n\t\tIlluminate\\Database\\Capsule\\Manager::schema()-\u003ecreate('users', function($table) {\n\t\t\t$table-\u003eincrements('id');\n\t\t\t$table-\u003estring('name');\n\t\t\t$table-\u003estring('email')-\u003eunique();\n\t\t\t$table-\u003etimestamps();\n\t\t});\n\t}\n}\n```\n\nCalling `Lassi\\Controller\\WelcomeController-\u003emakeUserTable()` will create a new table in database.\n\nA model can be added to a controller using `useModel()` method in controller's constructor i.e.\n\n```php\nclass WelcomeController extends Lassi\\App\\Controller {\n\tpublic function __construct() {\n\t\tparent::__construct(LassiLassi::getInstance());\n\t\t$this-\u003euseModel('user');\n\t}\n}\n```\n\nor it can directly be accessed using `Lassi\\Model` namespace i.e.\n\n```php\nclass WelcomeController extends Lassi\\App\\Controller {\n\t...\n\n\tpublic function create() {\n\t\t$user = new Lassi\\Model\\User;\n\t\t$user-\u003ename = 'Jabran Rafique';\n\t\t$user-\u003eemail = 'hello@jabran.me';\n\t\t$user-\u003esave();\n\t}\n}\n```\n\nGetting info from Eloquent and pass it to template.\n\n```php\nclass WelcomeController extends Lassi\\App\\Controller {\n\t...\n\n\tpublic function goodbye() {\n\t\t$user = Lassi\\Model\\User::find(1);\n\t\treturn $this-\u003eapp-\u003erender('goodbye.php', array('user' =\u003e $user));\n\t}\n}\n```\n\n# Issue tracking\nPlease report any issues to [repository issue tracker](https://github.com/jabranr/lassi/issues).\n\n# Contribution\nI would love to get some help and extend this boilerplate further so it can be useful to a vast audience. If you think you can improve the boilerplate then fork the project and submit pull request at your convenience.\n\n# License\nMIT License\n\u0026copy; 2015 \u0026ndash; 2016 Jabran Rafique ([@jabranr](https://twitter.com/jabranr)) | [Contributors](https://github.com/jabranr/lassi/graphs/contributors)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabranr%2Flassi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjabranr%2Flassi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabranr%2Flassi/lists"}