Code Monkey home page Code Monkey logo

php-website-starter's Introduction

PHP Website Starter

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

  1. Using Auryn to get actual dependency injections. Never pass around a container.
  2. Using PSR-7 HTTP message objects with PSR-17 factories for all request and response handling.
  3. Using nyholm/psr7-server to create the initial PSR-7 request.
  4. Using Middleland to run through all configured PSR-15 Middlewares.
  5. Using FastRoute to parse requested URIs and find the matching PSR-15 RequestHandlers.
  6. Using a Zend Emitter to output a final response to the web server.
  7. Using PHP CS Fixer to check all code against a somewhat opinionated set of style rules based on the Symfony Coding Standards.
  8. 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.

php-website-starter's People

Contributors

zegnat avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

daukantas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.