{"id":16840308,"url":"https://github.com/mgdm/slim-eloquent","last_synced_at":"2025-03-18T04:45:55.168Z","repository":{"id":23724219,"uuid":"27097299","full_name":"mgdm/Slim-Eloquent","owner":"mgdm","description":"A demo of using the Eloquent ORM with Slim","archived":false,"fork":false,"pushed_at":"2014-11-24T22:33:00.000Z","size":120,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-24T11:28:19.986Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mgdm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-24T22:05:09.000Z","updated_at":"2017-04-22T02:23:35.000Z","dependencies_parsed_at":"2022-08-22T03:31:06.400Z","dependency_job_id":null,"html_url":"https://github.com/mgdm/Slim-Eloquent","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgdm%2FSlim-Eloquent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgdm%2FSlim-Eloquent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgdm%2FSlim-Eloquent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgdm%2FSlim-Eloquent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgdm","download_url":"https://codeload.github.com/mgdm/Slim-Eloquent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244159990,"owners_count":20408019,"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":[],"created_at":"2024-10-13T12:36:10.845Z","updated_at":"2025-03-18T04:45:55.144Z","avatar_url":"https://github.com/mgdm.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Using Eloquent with Slim\nMost of the documentation I've seen up till now about using Eloquent outside of Laravel makes it use the static methods in order to access the models. While this is fine, it jars slightly with how I use Slim, where I put the repositories/mappers/whatever inside the Slim app container and access them using instance methods. Here's a demo of how I do it. You can check it out and run it, like so:\n\n```bash\ngit clone https://github.com/mgdm/Slim-Eloquent.git\ncd Slim-Eloquent\ncomposer install\nphp -S localhost:8080\n```\nYou'll also need access to a MySQL database, and to load the data from `create.sql` into it, and give the app access to it. The app will then be available on `http://localhost:8080`. \n\nMost of the work is done inside `index.php`, where the repositories for the `Authors` and `Books` are set up as singletons in the Slim app container.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgdm%2Fslim-eloquent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgdm%2Fslim-eloquent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgdm%2Fslim-eloquent/lists"}