It’s super quick to get a PHP-Prefixer project up and running. Install any library freely. PHP-Prefixer will manage your namespaces.
- Use the same libraries across all platforms: Develop your solutions using the same libraries for all the platforms you work in, specifically WordPress, Joomla, Drupal, Laravel, Symfony, Slim Framework, etc.
- Composer + WordPress: Use Composer for your WordPress projects. PHP-Prefixer will process the dependencies to run smoothly along with other third-party plug-ins.
- Fully integrated with Git: Declare your name space configuration and let the service produce the packages. No local installation. No Phars. No new dependencies.
This is the prefixed project.
The source project can be found in this repository: https://github.com/PHP-Prefixer/Getting-Started
The documentation about this sample code can be found here: https://php-prefixer.com/docs/guides/
This sample project is written based on Composer original documentation, Basic usage / Autoloading.
To run this sample project, run the following command:
~$ php a-simple-test.php
The test writes a file app.log
with the following output:
[2020-10-08 17:40:19] name.WARNING: Foo [] []
The prefixed Monolog library, generated by PHP-Prefixer, can be tested with original tests.
~/vendor_prefixed/monolog/monolog$ phpunit
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.
................................................................. 65 / 97 ( 67%)
................................ 97 / 97 (100%)
Time: 116 ms, Memory: 6.00MB
A few notes for future testers:
Monolog
v1 uses a custom autoloader in the unit tests. It had to be manually fixed to load from the right directory. For instance:vendor_prefixed/monolog/monolog/tests/Monolog/Functional/Handler/FirePHPHandlerTest.php
.- There is a test that checks the namespace of the loaded object. It has been updated to check the namespace prefixed with
PPP
. This is the modified test functionvendor_prefixed/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php / testDefFormatWithObject
.
MIT License
Copyright (c) 2020 Desarrollos Inteligentes Virtuales, SL