Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TutsPlus.com:
Using Illuminate Database With Eloquent in Your PHP App Without Laravel
Jan 26, 2017 @ 15:51:05

The TutsPlus.com site has posted a new tutorial showing you how you can use the Eloquent ORM from Laravel without having to use Laravel itself. There's already functionality built into the popular database interface that makes it possible, it's just a matter of turning it on.

Illuminate is Laravel’s database engine minus Laravel. It comes bundled with the Eloquent ORM in Laravel. If you would like to build your PHP apps with ORMs and prefer not to use Laravel, this tutorial is for you.

In this tutorial, we are going to build the back end for a Q&A App with PHP, Illuminate Database, and the Eloquent ORM.

They start the post with a list of requirements and a brief outline of what functionality the end result will include. With that defined the tutorial starts in on the directory structure of the application and the Composer configuration to pull in Eloquent and its requirements. Next up is the code to define the connection credentials and (raw) SQL to create the tables in the database. The database "capsule" is created and the code is shared to create simple controllers and matching models for users, questions, answers and upvotes. They show how to use relationships to get the linked objects between tables and how to perform update and delete operations.

tagged: illuminate database eloquent laravel outside tutorial capsule

Link: https://code.tutsplus.com/tutorials/using-illuminate-database-with-eloquent-in-your-php-app-without-laravel--cms-27247


Trending Topics: