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

Master Zend Framework:
How To Use Laravel’s Eloquent ORM with Zend Expressive
Aug 25, 2016 @ 16:43:47

On the Master Zend Framework site there's a new tutorial posted showing you how to integrate Laravel's Eloquent database library with Zend Expressive to replace the usual options of Doctrine or ZendDb.

When working with Zend Expressive, if you were to choose a database layer for your application, I guess that the first two names to come to mind would be either ZendDb or Doctrine. But what about Laravel’s ORM: Eloquent? That’s right, Eloquent!

I’ve been getting to know Laravel a bit better recently, primarily for the comparison I wrote about it and Zend Expressive not that long ago. The tutorial was exceptionally well received. So I thought I’d dig a bit further, and see if I could use Eloquent instead of my standard ZendDb. It turns out, with a bit of work, you can do it!

In today’s tutorial, I’m going to step you through how to make it available, using a project based off of the Zend Expressive Skeleton Installer.

He starts by installing the Eloquent package and setting it up with a simple configuration (using a Homestead environment). With that configuration set up, he shows how to make the Eloquent connection available to the rest of the application. Once the connection is set up he shows how to create a first model - Capital - and using it to create a new record. He also includes examples of retrieving all records and mentions three things that seem missing from this Eloquent install: the "artisan" command, migrations and database seeing functionality.

tagged: zendframework zendexpressive eloquent orm laravel integration tutorial

Link: http://www.masterzendframework.com/using-eloquent-with-expressive/


Trending Topics: