Introduction #
There are different OS, different dev stacks for each one. You probably use already one of them. If you work on different projects, with different PHP versions, you already know the struggle. Each project uses different PHP version (like 7.4 and 8.0, on different project 8.1 with ElasticSearch), different versions of databases (MariaDB, MySQL, Postgres, etc.) and switch between these projects needs a little work to make it as similar as server stack where it will be deployed.
IDE #
There is too much integrated development environments (IDE) available. You probably know most of them:
- Notepad++ which is not IDE, but many thinks it is,
- Eclipse PDT which is so old,
- NetBeans which is suitable, but not very developer friendly,
- PhpStorm which is the best,
- and others like Zend Studio or Komodo.
If you mean it seriously with PHP development, you should use PhpStorm. It has extended PHP inspections and support for PhpStan, which you should use to make your code long-term sustainable. Don’t forget to install plugins:
- PHP Inspections (EA Extended),
- Nette framework helpers,
- Neon support (free or paid, free is enough),
- Nextras ORM,
- Latte,
- etc.
Lando #
If you have your own stack and rutine, it’s ok. You don’t need to change the way you work. But if you want to upgrade your stack to another level, Lando is here to help you.
Here are some pros, why use Lando:
- Lando works on Docker, so your stack will be composed of multiple containers. Each container can have a specific version, e.g. exact version of MariaDB which will be on the server.
- Whole configuration of your stack is stored in
.lando.ymlfile, so anyone who cooperate with you on the project will have same versions, it’s likecomposer.lockfor your dev stack.- File
.lando.ymlis in your project root and will be versioned by your git repository. So in the future, you will see also changes of your stack.- Add a new service (e.g. ElasticSearch) is simple – just define new service in your
.lando.yml. When your colleague will fetch changes from git repository and start its stack, services defined there will be started as well. So no need to make any tutorials how to start the project.- It is for local developmet, therefore there is no need to make a development environment on your server – it is really a bad practice.
Just process with instalation instructions on Lando documentation. Supported are all OS, but if you use Linux, it will be super easy! If you use Windows, don’t forget that you need WSL2 enabled to be usable in terms of speed.
It provides also quick interface for you, for example:
lando startto start your project’s development stack,lando rebuildto rebuild if there is changes in your.lando.yml,lando stopto stop your project’s development stack,- custom defined like
lando consolefor your symfony console.
Makefile #
File named Makefile in your project root will be used for shortcuts for commands you use on a regular basis:
make startfor starting your project,make cachefor cleaning cache, so no more deleting temp files manually.
If you don’t have make command in your terminal, install it. You can google how to do it for your system.
Many of these will be described in further chapters.