This repository contains a small Slim4 application that initially does not define a specific PSR-7 implementation. It uses Continuous Integration (Travis-CI) to build and check the application against the four PSR-7 implementations supported by default by the slim framework.
# | PSR-7 Implementation | Status |
---|---|---|
1 | Slim PSR-7 | |
2 | Nyholm | |
3 | Guzzle | |
4 | Zend |
Note: Travis-CI is configured to be triggered automatically at least every 24 hours.
The following status used the development branch of Slim (4.x) to test against.
# | PSR-7 Implementation | Status |
---|---|---|
5 | Slim PSR-7 | |
6 | Nyholm | |
7 | Guzzle | |
8 | Zend |
Note: Travis-CI is configured to be triggered automatically at least every 24 hours.
When triggered, Travis-CI creates four different virtual machines. Each installs
an Apache web server and this application. The web server is configured such
that http://localhost/
points to the subdirectory public
. Then each virtual
machine would require via composer a different PSR-7 implementation.
Eventually the PHPUnit test is launched which would use the Guzzle HTTP Client to make http requests and validate the responses.
Web Application
public/.htaccess
This file contains the server override settings.public/index.php
This is the entry point on the server.composer.json
This is the composer file.
Travis-CI
build/travis-ci-apache.conf
The apache configuration..travis.yml
The travis configuration.
Tests
tests/bootstrap.php
The tests bootstrap.tests/*Test.php
The PHPUnit test classes.
Help in form of issues or pull requests would be very much welcomed.
- Clone your fork of this repository.
- Create a new branch for every patch, feature or improvement.
- Install the required libraries.
$ composer install
- Decide which PSR-7 implementation you would like to use during development and
install it using composer. Note that this would modify
composer.json
and therefore you must make sure that you do not commit those changes.- Slim
$ composer require slim/psr7
- Nyholm
$ composer require nyholm/psr7 nyholm/psr7-server
- Guzzle
$ composer require guzzlehttp/psr7 http-interop/http-factory-guzzle
- Zend
$ composer require zendframework/zend-diactoros
- Slim
- Install a web server, make sure that
localhost
points to thepublic/
subdirectory and start the web server. - Run the tests
$ vendor/bin/phpunit
By default you will get 1 skipped test. That test works only, if the environment
variable PSR7
is set to either Slim
, Nyholm
, Guzzle
or Zend
.