PHP 7 MVC Framework Project
The purpose of the project was to study the inner workings of a self-built PHP MVC (Model-View-Controller) framework.
To do so, I studied the book "Pro PHP MVC" (2012) by Chris Pitt - Apress Media LLC (Springer Nature) .
The book can be read and downloaded here :
https://www.dropbox.com/s/nxq0keypo9r0rkd/Pro%20PHP%20MVC.pdf?dl=0
The objectives were :
(1) To do all the book exercises (contained in the "Book exercises" folder)
(2) Considering that the PHP version at the time of writing was PHP version 5.4, go over the entire framework code
and rewrite it following the features of PHP 7 wherever possible maintaining code readability.
For (1), the exercises are written using PHP version 5.4
For (2), the major features of PHP 7 include :
-
Scalar type hints
-
Return type hints
-
Anonymous classes
-
Generator delegation
-
Generator return expressions
-
The null coalesce operator
-
The spaceship operator
-
Constant array
-
Uniform variable syntax
-
Throwables
-
Group use declarations
-
Class constant visibility modifiers
-
Catching multiple exceptions types
-
Iterable pseudo-type
-
Nullable types
-
Void return types
Some detailed explanations of the new features of PHP version 7 (i.e; versions 7.1,7.2,7.3,7.4) :
https://www.php.net/manual/en/migration70.new-features.php
https://www.php.net/manual/en/migration71.new-features.php
https://www.php.net/manual/en/migration72.new-features.php
https://www.php.net/manual/en/migration73.new-features.php
https://www.php.net/manual/en/migration74.new-features.php
(Some of the major changes between the book code and the framework version here involve both the naming and use of namespaces as well as the use of composer.json to autoload the framework classes.)