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

Helge Sverre:
Database migrations in PHP with Phinx
Jul 04, 2016 @ 16:14:55

Helge Sverre has put together an introduction of a tool perfect for anyone that's been looking for a framework-agnostic way to handle database migrations: Phinx.

Phinx is a database migration tool written by Rob Morgan in PHP, what that means is that you can tell Phinx that you want to create a new database table, add a column or edit the properties of a column by writing “migrations”.

You can then run this migration using the Phinx tool and it will connect to your database with the configuration that you specified and perform the database updates for you automatically.

He then walks you through a full introduction to the tool, breaking it down into sections:

  • Getting Phinx installed (via Composer)
  • Configuring it via a YAML file
  • Writing your first simple migrations
  • Creating database seeders (including the use of Faker data)
  • Rolling back your migrations

All of these topics come with plenty of code, configuration and output examples, helping you ensure you're on the right track.

tagged: database migration phinx library introduction faker tutorial

Link: https://helgesverre.com/blog/database-migrations-in-php-with-phinx/


Trending Topics: