PHP development guidelines repository with examples. This includes, but is not limited to:
-
design patterns
-
SOLID principles
-
OOP principles
All topics are covered with examples. The base for examples is Symfony 6.2 on PHP 8.2. Symfony is used just for convenience. The samples are written in pure PHP and are applicable to any PHP framework or CMS.
Important
|
This is not yet another repository which participates in the cacophony of those who simply rewrite the theory and add a couple of examples. The purpose of this repository is to go deeper and actually analyze and challenge design patterns, OOP and other concepts/principles, and to provide objectively better alternatives where applicable. All topics covered here will have a set of examples which you can run immediately - either by CLI (Docker included) or by running implemented PHPUnit tests. |
-
22.01.2023.:
-
Finished Adapter design pattern
-
Next up: Decorator design pattern
-
Important
|
Table of contents is available on a separate page. |
The best way to use this repository is to clone it and open it in an IDE. AsciiDoc documentation and PHP examples are being written in PHPStorm with AsciiDoc plugin. It is recommended to use PHPStorm and AsciiDoc plugin for the best experience.
The documentation uses custom CSS for AsciiDoc rendering. If the documentation text is not rendered correctly in your IDE, make sure that the following configuration is set:
-
File > Settings… > Languages & Frameworks > AsciiDoc
-
Preview browser: JCEF Browser
-
Safe mode: UNSAFE
-
You are free to use this repository as an online resource. However, if you would like to run the provided examples, you can clone this repository and use it on your local machine.
There are two ways of running the examples:
-
On your local machine
-
You need to have PHP 8.2 installed and active. Check it by running
php -v
. -
Your local PHP installation must be able to run Symfony 6.2.
-
Run (in root directory of the cloned repository):
-
composer install
-
Inside a Docker container
-
You need to have Docker installed and running.
-
Run (in root directory of the cloned repository):
-
docker-compose up --build
All examples in the documentation have both commands (local and docker) included.
-
Code license: Apache License 2.0. Original license is also available at: https://www.apache.org/licenses/LICENSE-2.0
-
Documentation license: CC BY-NC-SA 4.0. Original license is also available at: https://creativecommons.org/licenses/by-nc-sa/4.0/
Author: Nikola D. Stojiljković / constUP