This article is targeted on Laravel beginners. No skills required whatsoever. Article is a tad opinionated, so take it with a grain of salt. Also, details are omitted for the sake of brevity.

Thus I will do the actual comparison as well as give several hints to get started.

If you’ve never heard of Doctrine, it is database abstraction layer. Sorta like Eloquent, but different type: Laravel is active record (AR), while Doctrine is object relational mapper (ORM).

Laravel migrations (docs)

In Laravel we have database/migrations folder which stores all migration classes. Laravel also keeps a table in database to keep track of past migrations. The system is dead simple and typical workflow goes as follows:

Upsides

Downsides

Doctrine migrations (docs)

In Doctrine we define schema as annotations on entity classes. Migrations are generated automatically by comparing your current schema to expected one. Migrations are presented in raw SQL and you can tinker them when needed (which is reasonably rare). Here’s your typical workflow:

Upsides

Downsides

Conclusion

You might want to use Doctrine migrations even without using whole Doctrine ecosystem. They’re very time efficient and scalable. Laravel migrations are thus admissible only for simplest cases.

Some additional info

Originally published at gist.github.com.