zegnat / website-starter
My minimum viable setup for starting a PHP project.
Installs: 18
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 1
Open Issues: 1
Type:project
Requires
- middlewares/fast-route: ^1.2
- nyholm/psr7-server: ^0.3.0
- oscarotero/middleland: ^1.0
- rdlowrey/auryn: ^1.4
- zendframework/zend-diactoros: ^2.1
- zendframework/zend-httphandlerrunner: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.15
- phpunit/phpunit: ^8.3
This package is auto-updated.
Last update: 2024-10-25 01:59:18 UTC
README
The PHP Website Starter is my minimum viable setup for starting a PHP project.
What my minimum setup is changes all the time, and this repository will change with it. The idea is that, whenever I start a new website project, I can get a checkout of the current state of this repository without having to think about where I will start.
This is heavily inspired by the Fermi Framework and even uses similar dependencies. But I have a slightly different way of wanting to handle my configurations and base dependencies.
Usage
Via Composer
$ composer create-project zegnat/website-starter
Current Practices
- Using Auryn to get actual dependency injections. Never pass around a container.
- Using PSR-7 HTTP message objects with PSR-17 factories for all request and response handling.
- Using nyholm/psr7-server to create the initial PSR-7 request.
- Using Middleland to run through all configured PSR-15 Middlewares.
- Using FastRoute to parse requested URIs and find the matching PSR-15 RequestHandlers.
- Using a Zend Emitter to output a final response to the web server.
- Using PHP CS Fixer to check all code against a somewhat opinionated set of style rules based on the Symfony Coding Standards.
- Using PHPUnit to test all classes used in the project and generate
coverage reports using
phpdbg
.
PSR-7 & PSR-17 Providers
By default this project loads Diactoros for its PSR-7 objects and matching PSR-17 factories.
The providers can easily be swapped for a different set of implementations. Simply remove the dependency from composer and add a new one. Example:
$ composer remove zendframework/zend-diactoros $ composer require nyholm/psr7
Then change the injector configuration to tell
Auryn which factories it should use. In the case of nyholm/psr7 all of
them can be defined as Nyholm\Psr7\Factory\Psr17Factory::class
.
License
The BSD Zero Clause License (0BSD). Please see the LICENSE file for more information.