Class Instantiation Shortcut for PHP
Library which create custom Shortcut for classes Instantiation.
Requires: PHP 5.3+
Why Create Shortcut for PHP classes Instantiation?
Typically you would create Shortcut for class instantiation if:
You need something more customized just like PHP create arrays with the array() function .
You want to be more productive avoiding the "new" keyword usage but also too long class name repetitive usage .
Just for the fun to do it.
Because you are just crazy in love with functions -:).
How to use it
Require the library by issuing this command:
composer require manuwhat/Shortcut
require 'vendor/autoload.php'; to the top of your script.
Next, create a Shortcut, just like this:
Shortcut is once and forever until cache suppression automatically created and the code included then you can use it in your script:
$obj=chosen_Shortcut_name(); // ==> ### if no chosen name has been specified then you may use!
$obj=fullQualifiedclassname();// of course you must pass the arguments if the constructor require them at instantiation
By default shortcuts are cached in a default directory but you can specify a custom directory path where shortcuts will be saved using
Keep in mind that only one custom Shortcut can be defined per class and that only instantiable classes can be used.
To run unit tests