I am recently working in a ASP.Net MVC project where we use code first technique to create all the database table. I really liked the idea, where you don't need to touch the database and create the model classes which are automatically mapped to the database by the EF layer.
I am planning to start a hobby project with PHP and was playing with Laravel (I am newbie in PHP). I was wondering if there is any equivalent framework in PHP that support code first pattern as EF 4.1?
I was looking into some Laravel tutorial, it looks like the ORM (eloquent) doesn't work exactly same way as the EF 4.1 in .net does. I seems to me that you still need to create the table in the database and then you create a model to map the database. Am I missing something?
Thanks.
For PHP i suggest looking at Doctrine 2 as ORM. You define your Entities and doctrine will generate the classes and database structure for you.
You may also look into ReadBeanPHP if you are going to write PHP from scratch. Not very feature-rich or beautiful, but it works :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With