We like to build web applications: a booking system, a cycling pool or a tool to keep track of the size of your children. Before we start with the development of such an application, we have to decide which framework to use for the development. Those type of decisions depend off course, at least partly, on the wishes of our clients. For some web applications WordPress is very suitable. WordPress has already a lot features related to users, user roles, creation and editing of pages included. If the client also want to connect a blog to its application, WordPress is great.
For applications in which you want to have full control over each functionality and every little detail, its often better not to use a CMS like WordPress. For those custom applications, you can either start from scratch, our use a framework that at least structures your code and keep it maintainable. For very small web applications it might be fine to start from a blank page, but as soon as an application becomes more complex, a framework will be of great help.
For the serverside code, we now use the php framework Laravel for the development of applications. Laravel has a model-view-controller structure and several great tools to simplify the development. Version control of the database has always been a bit of challenge, especially when an application is used in a production environment, while the development of the application is continued on a local computer. Development and the implementation of additional functionalities to your application ofter require change to the structure of the database, and at some point those change also have to be done in the production environment. Laravel makes use of ‘migrations’. The creation of new database tables, or the editing of existings tables is no longer done in a tool like phpmyadmin. Instead, you write a simple migration file, which can be put in version control using a tool like git or svn. When the new features of your application are ready, all files are moved to the webserver. With a simple command (‘php artisan migrate’) all migrations are run and your database is up-to-date.
When adding more functionality and your web application is getting more complex, version control (e.g. Git) and the use of multiple development environments will be getting more important. You may use a local, staging and production environment. Each new feature will first be developed locally. If your satisfied, the feature can be moved to the staging environment, where also your client can have a look. Extensive tests can be done to make sure that everything is working as it should be, then the feature can be included in the production version of your application.
This workflow may be a bit complicated due to the different configuration files for the different environments (e.g. database credentials). Laravel has possibilities to recognize these environments and use the correct configuration files automatically. This way, all configuration files can be under version control, while your application chooses the correct files.
The use of database migrations and detection of development environments are only two features of Laravel that improve your workflow during the development of applications. Next blog will discuss the ‘create, read, update and delete’ operations (CRUD) operations of Laravel.