{"id":18498624,"url":"https://github.com/masfranzhuo/slimphp-crud","last_synced_at":"2025-04-09T00:31:21.207Z","repository":{"id":174559589,"uuid":"120096593","full_name":"masfranzhuo/slimphp-CRUD","owner":"masfranzhuo","description":"Slim framework CRUD application with MySQL database and Eloquent ORM.","archived":false,"fork":false,"pushed_at":"2018-02-03T14:11:49.000Z","size":18,"stargazers_count":8,"open_issues_count":0,"forks_count":5,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-23T19:51:31.096Z","etag":null,"topics":["eloquent","eloquent-models","eloquent-orm","mysql","php","slim","slim-3","slim-framework","slim3","slim3-skeleton","slimframework","slimphp"],"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/masfranzhuo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-03T14:06:52.000Z","updated_at":"2024-10-09T17:34:00.000Z","dependencies_parsed_at":"2023-07-29T17:15:07.956Z","dependency_job_id":null,"html_url":"https://github.com/masfranzhuo/slimphp-CRUD","commit_stats":null,"previous_names":["masfranzhuo/slimphp-crud"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masfranzhuo%2Fslimphp-CRUD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masfranzhuo%2Fslimphp-CRUD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masfranzhuo%2Fslimphp-CRUD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masfranzhuo%2Fslimphp-CRUD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/masfranzhuo","download_url":"https://codeload.github.com/masfranzhuo/slimphp-CRUD/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247949896,"owners_count":21023411,"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":["eloquent","eloquent-models","eloquent-orm","mysql","php","slim","slim-3","slim-framework","slim3","slim3-skeleton","slimframework","slimphp"],"created_at":"2024-11-06T13:41:46.105Z","updated_at":"2025-04-09T00:31:21.201Z","avatar_url":"https://github.com/masfranzhuo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Slim PHP CRUD\n\nThis CRUD Slim framework use project structure from [Slim Framework 3 skeleton](https://github.com/slimphp/Slim-Skeleton). \n\nUse this skeleton application to quickly setup and start working on a new Slim Framework 3 application. This application uses the latest Slim 3 with the PHP-View template renderer. It also uses the Monolog logger.\n\nThis skeleton application was built for Composer. This makes setting up a new Slim Framework application quick and easy.\n\n## Install the Application\n\nRun this command from the directory in which you want to install your new Slim Framework application.\n```\ncomposer create-project slim/slim-skeleton slimphp-CRUD\n```\n\n## Install Eloquent ORM\n\nThis application also use eloquent ORM from Laravel. The documentation is [here](https://www.slimframework.com/docs/cookbook/database-eloquent.html).\n```\ncomposer require illuminate/database \"~5.1\"\n```\n\n## Database\n\nThe application connect to MySQL database. The configuration of database added in setting and  dependencies file.\n\nDatabase connection settings on 'src/settings.php'\n```\n'db' =\u003e [\n    'driver' =\u003e 'mysql',\n    'host' =\u003e 'localhost',\n    'database' =\u003e 'example',\n    'username' =\u003e 'root',\n    'password' =\u003e '',\n    'charset'   =\u003e 'utf8',\n    'collation' =\u003e 'utf8_unicode_ci',\n    'prefix'    =\u003e '',\n]\n```\n\nService factory for the ORM on 'src/dependencies.php'\n```\n$container['db'] = function ($container) {\n    $capsule = new \\Illuminate\\Database\\Capsule\\Manager;\n    $capsule-\u003eaddConnection($container['settings']['db']);\n\n    $capsule-\u003esetAsGlobal();\n    $capsule-\u003ebootEloquent();\n\n    return $capsule;\n};\n```\n\nAlso don't forget to initialize Eloquent on 'public/index.php'\n```\n$app-\u003egetContainer()-\u003eget(\"db\");\n```\n\nThe database schema could be imported from example.sql. This app use database named 'example' and 'books' table which has 4 columns. \n```\nCREATE TABLE IF NOT EXISTS `books` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `title` varchar(50) NOT NULL,\n  `author` varchar(50) NOT NULL,\n  `category` varchar(50) NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;\n```\n\n## Model\nCreate 'models' folder on the root path and put schema file there. After that initialiaze model file path on index.php file.\n\nRegister model on 'public/index.php'\n```\nrequire '/../Models/Book.php';\n```\n\n## Route\nCreate 'routes' folder on the root path and put route file there. After that initialiaze route file path on index.php file.\n\nRegister routes by model on 'public/index.php'\n```\nrequire __DIR__ . '/../routes/books.php';\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasfranzhuo%2Fslimphp-crud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasfranzhuo%2Fslimphp-crud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasfranzhuo%2Fslimphp-crud/lists"}