{"id":11,"date":"2022-04-29T13:35:27","date_gmt":"2022-04-29T13:35:27","guid":{"rendered":"https:\/\/perangkatlunakku.com\/?p=11"},"modified":"2022-12-21T07:20:26","modified_gmt":"2022-12-21T07:20:26","slug":"slim4-tutorial-api-1-database-eloquent-tanpa-laravel","status":"publish","type":"post","link":"https:\/\/perangkatlunakku.com\/en\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/","title":{"rendered":"Slim4 Tutorial: 1 Eloquent database without Laravel"},"content":{"rendered":"<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"300\" src=\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim4-eloquent-without-laravel.png\" alt=\"Slim4 Eloquent tanpa Laravel\" class=\"wp-image-26\" srcset=\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim4-eloquent-without-laravel.png 300w, https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim4-eloquent-without-laravel-150x150.png 150w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/figure>\n\n\n\n<p>Install database package\/library <strong>Eloquent without Laravel<\/strong> can be applied in <strong>Slim4<\/strong> to create <strong>Fashion Store API<\/strong>Slim4 is a PHP micro framework, while Eloquent is <a href=\"https:\/\/perangkatlunakku.com\/en\/slim4-tutorial-api-5-database-transaction\/\" target=\"_blank\" rel=\"noreferrer noopener\">object-relational mapper (ORM)<\/a> ibrary used in Laravel. Slim4 comes with a small file size that does not have a default database library. It can be paired with Laravel Eloquent. Even though, Slim4 comes with small file size, it can be used to create <em>full-featured web app<\/em>However, in this tutorial, we will discuss how to create <strong>PHP backend<\/strong> API. In this <strong>Slim4 Tutorial: 1 Eloquent database without Laravel<\/strong> , we will disccuss how to install and implement the Laravel Eloquent in Slim4.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-instalasi-slim4\">Slim4 Installation<\/h2>\n\n\n\n<p>Slim4 installation is quite simple, some of the applications needed before installation is <strong>apache2<\/strong>, <strong>php7.4<\/strong> and <strong>composer<\/strong>. Command used to installation it as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">mkdir fashion-store-slim4\ncd fashion-store-slim4\ncomposer require slim\/slim:\"4.*\"\ncomposer require slim\/psr7<\/code><\/pre>\n\n\n\n<p>Directory structure after successful installation:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"255\" height=\"151\" src=\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim-1-instalasi.png\" alt=\"Slim4 struktur direktori Eloquent tanpa Laravel\" class=\"wp-image-21\"\/><\/figure>\n\n\n\n<p>Example name that will be used for database is <strong>fashion_store_db<\/strong> and for table will use <strong>user<\/strong>. Design for user table like below:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"159\" height=\"247\" src=\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/04\/slim1-user.png\" alt=\"Table user Slim4 Eloquent tanpa Laravel\" class=\"wp-image-12\"\/><\/figure>\n\n\n\n<p>MySQL script to create a User table as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">CREATE TABLE IF NOT EXISTS `fashion_store_db`.`user` (\n  `id` INT NOT NULL AUTO_INCREMENT,\n  `email` VARCHAR(100) NOT NULL,\n  `password` VARCHAR(100) NULL,\n  `name` VARCHAR(100) NULL,\n  `level` INT NULL,\n  `status` INT NULL,\n  `created_at` DATETIME NULL,\n  `updated_at` DATETIME NULL,\n  PRIMARY KEY (`id`),\n  UNIQUE INDEX `email_UNIQUE` (`email` ASC) VISIBLE)\nENGINE = InnoDB;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-php-slim4-tutorial-1-database-eloquent-tanpa-laravel\">PHP Slim4 Tutorial: 1 Eloquent database without Laravel<\/h2>\n\n\n\n<p>There are many choices of packages that can be used as database connector in Slim4, one of popular packages is <strong>Eloquent <\/strong>Laravel. Eloquent itself is a <em>standalone <\/em>package which is can be installed without having full of Laravel. Installing Eloquent on Slim4 can be done by composer:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">composer require illuminate\/database:*<\/code><\/pre>\n\n\n\n<p>After composer installed required packages successfully, create files in <strong><em>config\/settings.php<\/em> <\/strong>and <em><strong>config\/dependencies.php<\/strong><\/em>.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"251\" height=\"178\" src=\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim-2-eloquent.png\" alt=\"Settings Slim4 Eloquent tanpa Laravel\" class=\"wp-image-22\"\/><\/figure>\n\n\n\n<p>File <em>settings.php<\/em> file will be used to store application setting codes. Example code for settings:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\nreturn [\n    'db' =&gt; [\n        'driver' =&gt; 'mysql',\n        'host' =&gt; '127.0.0.1',\n        'database' =&gt; 'database',\n        'username' =&gt; 'username',\n        'password' =&gt; 'password',\n        'charset' =&gt; 'utf8',\n        'collation' =&gt; 'utf8_general_ci',\n    ]\n];<\/code><\/pre>\n\n\n\n<p>Before Eloquent database is used in on Slim4, first we need to initialize the database setting first. Initialization will be done in <em><strong>config\/dependencies.php<\/strong><\/em>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\n$capsule = new \\Illuminate\\Database\\Capsule\\Manager;\n$capsule-&gt;addConnection($settings['db']);\n$capsule-&gt;bootEloquent();\n$capsule-&gt;setAsGlobal();<\/code><\/pre>\n\n\n\n<p>After initializing the database setting, add codes <em>composer.json<\/em>to trigger the autoload function. The autoload function will call App namespace, it will used to accommodate the needed from application, for example Models namespace in models directory. The model file location is in <strong><em>src\/Models<\/em><\/strong>directory. Add autoload in <em>composer.json<\/em> as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n    ...\n    \"autoload\": {\n        \"psr-4\": {\n            \"App\\\\\": \"src\/\"\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p>Regenerate the files with the composer command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">composer dump-autoload<\/code><\/pre>\n\n\n\n<p>Create User model at <em><strong>src\/Models\/User.php<\/strong><\/em><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"256\" height=\"233\" src=\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim-3-user-model.png\" alt=\"User model Slim4 Eloquent tanpa Laravel\" class=\"wp-image-23\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-mengakses-model-user\">Accessing the User model<\/h2>\n\n\n\n<p>By initialized <strong>Eloquent without Laravel <\/strong>in dependencies, we can be used it in <strong>Slim4<\/strong>User model will access directly to the database and we can use the Larevel's Eloquent syntax in Slim4. Next step is to extend the class from Eloquent to User Model, for example, the Models User class extends the Eloquent Model class. The <strong>$table<\/strong> attribute is used to indicate the name of the table used by the model. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\nnamespace App\\Models;\n\nuse Illuminate\\Database\\Eloquent\\Model;\n\nclass User extends Model\n{\n    protected $table = 'user';\n    protected $primaryKey = 'id';\n}<\/code><\/pre>\n\n\n\n<p>Create files in <em><strong>public\/index.php<\/strong> <\/em>and <em><strong>public\/.htaccess<\/strong> <\/em>Directory structure will be like:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"252\" height=\"309\" src=\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim-4-index.png\" alt=\"Route Slim4 Eloquent tanpa Laravel\" class=\"wp-image-24\" srcset=\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim-4-index.png 252w, https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim-4-index-245x300.png 245w\" sizes=\"auto, (max-width: 252px) 100vw, 252px\" \/><\/figure>\n\n\n\n<p>We need to enable the <strong>rewrite<\/strong> module in apache2, because route function will not working well if it did not enabled. Rewrite module will remove the <strong>index.php<\/strong> from the address bar in the browser. Enabling the rewrite module using the terminal:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">a2enmod rewrite<\/code><\/pre>\n\n\n\n<p>Add codes at <em><strong>.htaccess<\/strong><\/em> to rewrite the index.php file<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">RewriteEngine On\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteRule ^ index.php [QSA,L]<\/code><\/pre>\n\n\n\n<p>Example route to get user data as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\nuse Psr\\Http\\Message\\ResponseInterface as Response;\nuse Psr\\Http\\Message\\ServerRequestInterface as Request;\nuse Slim\\Factory\\AppFactory;\nuse App\\Models\\User;\n\nrequire __DIR__ . '\/..\/vendor\/autoload.php';\n\n$app = AppFactory::create();\n$app-&gt;setBasePath('\/fashion-store-slim4\/public');\n\n$settings = require __DIR__ . '\/..\/config\/settings.php';\nrequire __DIR__ . '\/..\/config\/dependencies.php';\n\n$app-&gt;get('\/user', function (Request $request, Response $response) {\n    $user = User::all();\n    $data = json_encode($user);\n    $response-&gt;getBody()-&gt;write($data);\n    return $response\n        -&gt;withHeader('Content-Type', 'application\/json')\n        -&gt;withStatus(200);\n});\n\n$app-&gt;run();<\/code><\/pre>\n\n\n\n<p>Application can be tested using Postman by <strong>localhost\/fashion-store-slim4\/public\/user<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"625\" src=\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim-5-user-list-1024x625.png\" alt=\"Postman daftar user Slim4 Eloquent\" class=\"wp-image-25\" srcset=\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim-5-user-list-1024x625.png 1024w, https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim-5-user-list-300x183.png 300w, https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim-5-user-list-768x468.png 768w, https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim-5-user-list.png 1115w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Full code can be viewed at <a data-type=\"URL\" data-id=\"https:\/\/github.com\/pradesn\/fashion-store-slim4\/tree\/8d2a82f9928f02223ce4cecc6924d52fed3bd4e1\" href=\"https:\/\/github.com\/pradesn\/fashion-store-slim4\/tree\/8d2a82f9928f02223ce4cecc6924d52fed3bd4e1\" target=\"_blank\" rel=\"noreferrer noopener\">Github<\/a>A complete list Slim4 API tutorials can be viewed via <a href=\"https:\/\/perangkatlunakku.com\/en\/tutorial-php-backend-slim4\/\" target=\"_blank\" rel=\"noreferrer noopener\">link ini<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Using the Eloquent database package\/library without Laravel can be applied in Slim4 (fashion store API).<\/p>","protected":false},"author":1,"featured_media":26,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[9,7,4],"class_list":["post-11","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial","tag-fashion-store-api","tag-php-backend","tag-slim4"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.5 (Yoast SEO v23.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Slim4 Tutorial: 1 Database Eloquent tanpa Laravel - perangkatlunakku<\/title>\n<meta name=\"description\" content=\"Menggunakan package\/library Eloquent database tanpa Laravel bisa diterapkan pada Slim4 untuk membuat fashion store API.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/perangkatlunakku.com\/en\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Slim4 Tutorial: 1 Database Eloquent tanpa Laravel\" \/>\n<meta property=\"og:description\" content=\"Menggunakan package\/library Eloquent database tanpa Laravel bisa diterapkan pada Slim4 untuk membuat fashion store API.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/perangkatlunakku.com\/en\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/\" \/>\n<meta property=\"og:site_name\" content=\"perangkatlunakku\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/groups\/perangkatlunakku\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-29T13:35:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-21T07:20:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim4-eloquent-without-laravel.png\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Prade\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:description\" content=\"Menggunakan package\/library Eloquent database tanpa Laravel bisa diterapkan pada Slim4 untuk membuat fashion store API.\" \/>\n<meta name=\"twitter:creator\" content=\"@prangkatlunakku\" \/>\n<meta name=\"twitter:site\" content=\"@prangkatlunakku\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prade\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/\"},\"author\":{\"name\":\"Prade\",\"@id\":\"https:\/\/perangkatlunakku.com\/#\/schema\/person\/b2ab89d36e0aad24731c098cdff81662\"},\"headline\":\"Slim4 Tutorial: 1 Database Eloquent tanpa Laravel\",\"datePublished\":\"2022-04-29T13:35:27+00:00\",\"dateModified\":\"2022-12-21T07:20:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/\"},\"wordCount\":506,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\/\/perangkatlunakku.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim4-eloquent-without-laravel.png\",\"keywords\":[\"fashion-store-api\",\"php-backend\",\"slim4\"],\"articleSection\":[\"Tutorial\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/\",\"url\":\"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/\",\"name\":\"Slim4 Tutorial: 1 Database Eloquent tanpa Laravel - perangkatlunakku\",\"isPartOf\":{\"@id\":\"https:\/\/perangkatlunakku.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim4-eloquent-without-laravel.png\",\"datePublished\":\"2022-04-29T13:35:27+00:00\",\"dateModified\":\"2022-12-21T07:20:26+00:00\",\"description\":\"Menggunakan package\/library Eloquent database tanpa Laravel bisa diterapkan pada Slim4 untuk membuat fashion store API.\",\"breadcrumb\":{\"@id\":\"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#primaryimage\",\"url\":\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim4-eloquent-without-laravel.png\",\"contentUrl\":\"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim4-eloquent-without-laravel.png\",\"width\":300,\"height\":300,\"caption\":\"Slim4 database with Eloquent without Laravel\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/perangkatlunakku.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Slim4 Tutorial: 1 Database Eloquent tanpa Laravel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/perangkatlunakku.com\/#website\",\"url\":\"https:\/\/perangkatlunakku.com\/\",\"name\":\"perangkatlunakku\",\"description\":\"perangkatlunakku permudah kehidupan\",\"publisher\":{\"@id\":\"https:\/\/perangkatlunakku.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/perangkatlunakku.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/perangkatlunakku.com\/#organization\",\"name\":\"perangkatlunakku\",\"url\":\"https:\/\/perangkatlunakku.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/perangkatlunakku.com\/#\/schema\/logo\/image\/\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"perangkatlunakku\"},\"image\":{\"@id\":\"https:\/\/perangkatlunakku.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/groups\/perangkatlunakku\",\"https:\/\/x.com\/prangkatlunakku\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/perangkatlunakku.com\/#\/schema\/person\/b2ab89d36e0aad24731c098cdff81662\",\"name\":\"Prade\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/perangkatlunakku.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0ee64dbab8883b02f7f89ed14f84c1757d30944d9f72e901d2664375df425a77?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0ee64dbab8883b02f7f89ed14f84c1757d30944d9f72e901d2664375df425a77?s=96&d=mm&r=g\",\"caption\":\"Prade\"},\"sameAs\":[\"http:\/\/perangkatlunakku.com\"],\"url\":\"https:\/\/perangkatlunakku.com\/en\/author\/pradesn\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Slim4 Tutorial: 1 Database Eloquent tanpa Laravel - perangkatlunakku","description":"Menggunakan package\/library Eloquent database tanpa Laravel bisa diterapkan pada Slim4 untuk membuat fashion store API.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/perangkatlunakku.com\/en\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/","og_locale":"en_US","og_type":"article","og_title":"Slim4 Tutorial: 1 Database Eloquent tanpa Laravel","og_description":"Menggunakan package\/library Eloquent database tanpa Laravel bisa diterapkan pada Slim4 untuk membuat fashion store API.","og_url":"https:\/\/perangkatlunakku.com\/en\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/","og_site_name":"perangkatlunakku","article_publisher":"https:\/\/www.facebook.com\/groups\/perangkatlunakku","article_published_time":"2022-04-29T13:35:27+00:00","article_modified_time":"2022-12-21T07:20:26+00:00","og_image":[{"width":300,"height":300,"url":"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim4-eloquent-without-laravel.png","type":"image\/png"}],"author":"Prade","twitter_card":"summary_large_image","twitter_description":"Menggunakan package\/library Eloquent database tanpa Laravel bisa diterapkan pada Slim4 untuk membuat fashion store API.","twitter_creator":"@prangkatlunakku","twitter_site":"@prangkatlunakku","twitter_misc":{"Written by":"Prade","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#article","isPartOf":{"@id":"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/"},"author":{"name":"Prade","@id":"https:\/\/perangkatlunakku.com\/#\/schema\/person\/b2ab89d36e0aad24731c098cdff81662"},"headline":"Slim4 Tutorial: 1 Database Eloquent tanpa Laravel","datePublished":"2022-04-29T13:35:27+00:00","dateModified":"2022-12-21T07:20:26+00:00","mainEntityOfPage":{"@id":"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/"},"wordCount":506,"commentCount":3,"publisher":{"@id":"https:\/\/perangkatlunakku.com\/#organization"},"image":{"@id":"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#primaryimage"},"thumbnailUrl":"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim4-eloquent-without-laravel.png","keywords":["fashion-store-api","php-backend","slim4"],"articleSection":["Tutorial"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/","url":"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/","name":"Slim4 Tutorial: 1 Database Eloquent tanpa Laravel - perangkatlunakku","isPartOf":{"@id":"https:\/\/perangkatlunakku.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#primaryimage"},"image":{"@id":"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#primaryimage"},"thumbnailUrl":"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim4-eloquent-without-laravel.png","datePublished":"2022-04-29T13:35:27+00:00","dateModified":"2022-12-21T07:20:26+00:00","description":"Menggunakan package\/library Eloquent database tanpa Laravel bisa diterapkan pada Slim4 untuk membuat fashion store API.","breadcrumb":{"@id":"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#primaryimage","url":"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim4-eloquent-without-laravel.png","contentUrl":"https:\/\/perangkatlunakku.com\/wp-content\/uploads\/2022\/05\/slim4-eloquent-without-laravel.png","width":300,"height":300,"caption":"Slim4 database with Eloquent without Laravel"},{"@type":"BreadcrumbList","@id":"https:\/\/perangkatlunakku.com\/2022\/04\/29\/slim4-tutorial-api-1-database-eloquent-tanpa-laravel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/perangkatlunakku.com\/"},{"@type":"ListItem","position":2,"name":"Slim4 Tutorial: 1 Database Eloquent tanpa Laravel"}]},{"@type":"WebSite","@id":"https:\/\/perangkatlunakku.com\/#website","url":"https:\/\/perangkatlunakku.com\/","name":"perangkatlunakku","description":"perangkatlunakku permudah kehidupan","publisher":{"@id":"https:\/\/perangkatlunakku.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/perangkatlunakku.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/perangkatlunakku.com\/#organization","name":"perangkatlunakku","url":"https:\/\/perangkatlunakku.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/perangkatlunakku.com\/#\/schema\/logo\/image\/","url":"","contentUrl":"","caption":"perangkatlunakku"},"image":{"@id":"https:\/\/perangkatlunakku.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/groups\/perangkatlunakku","https:\/\/x.com\/prangkatlunakku"]},{"@type":"Person","@id":"https:\/\/perangkatlunakku.com\/#\/schema\/person\/b2ab89d36e0aad24731c098cdff81662","name":"Prade","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/perangkatlunakku.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0ee64dbab8883b02f7f89ed14f84c1757d30944d9f72e901d2664375df425a77?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0ee64dbab8883b02f7f89ed14f84c1757d30944d9f72e901d2664375df425a77?s=96&d=mm&r=g","caption":"Prade"},"sameAs":["http:\/\/perangkatlunakku.com"],"url":"https:\/\/perangkatlunakku.com\/en\/author\/pradesn\/"}]}},"_links":{"self":[{"href":"https:\/\/perangkatlunakku.com\/en\/wp-json\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/perangkatlunakku.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/perangkatlunakku.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/perangkatlunakku.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/perangkatlunakku.com\/en\/wp-json\/wp\/v2\/comments?post=11"}],"version-history":[{"count":0,"href":"https:\/\/perangkatlunakku.com\/en\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/perangkatlunakku.com\/en\/wp-json\/wp\/v2\/media\/26"}],"wp:attachment":[{"href":"https:\/\/perangkatlunakku.com\/en\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/perangkatlunakku.com\/en\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/perangkatlunakku.com\/en\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}