Skip to content

Commit b3a99a0

Browse files
refactor: revamp project
1 parent 1ffcba0 commit b3a99a0

20 files changed

+3200
-709
lines changed

.gitattributes

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/tests export-ignore
2-
/.gitattributes export-ignore
3-
/.gitignore export-ignore
4-
/.scrutinizer.yml export-ignore
5-
/LICENSE export-ignore
6-
/CODE_OF_CONDUCT.md export-ignore
7-
/CONTRIBUTING.md export-ignore
8-
/phpunit.xml export-ignore
9-
/README.md export-ignore
1+
/CODE_OF_CONDUCT.md export-ignore
2+
/Dockerfile export-ignore
3+
/README.md export-ignore
4+
/docker-compose.yml export-ignore
5+
/phpunit.xml export-ignore
6+
/tests export-ignore
7+
/CONTRIBUTING.md export-ignore
8+
/LICENSE export-ignore
9+
/phpstan.neon export-ignore
10+
/.travis.yml export-ignore

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
/vendor/
2-
.idea
3-
composer.phar
4-
.DS_Store
2+
.php_cs.cache

.php_cs.dist

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()->in(__DIR__);
4+
5+
return PhpCsFixer\Config::create()
6+
->setFinder($finder)
7+
->setRules(array(
8+
'@Symfony' => true,
9+
'@Symfony:risky' => true,
10+
'@PHPUnit48Migration:risky' => true,
11+
'array_syntax' => array('syntax' => 'short'),
12+
'ordered_imports' => true,
13+
'protected_to_private' => false,
14+
'declare_strict_types' => true,
15+
'fully_qualified_strict_types' => true,
16+
'date_time_immutable' => true,
17+
'mb_str_functions' => true,
18+
'strict_param' => true,
19+
'native_function_invocation' => true,
20+
))
21+
->setRiskyAllowed(true);

.scrutinizer.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
sudo: required
2+
3+
language: generic
4+
5+
services:
6+
- docker
7+
8+
before_install:
9+
- docker build -t moon/http-middleware .
10+
- docker run --name http-middleware -itd -e "TRAVIS=$TRAVIS" -e "TRAVIS_JOB_ID=$TRAVIS_JOB_ID" moon/http-middleware bash
11+
12+
13+
script:
14+
- docker exec http-middleware /bin/sh -c "php vendor/bin/php-cs-fixer fix --dry-run --diff --config=.php_cs.dist"
15+
- docker exec http-middleware /bin/sh -c "php vendor/bin/phpunit --coverage-clover clover.xml"
16+
17+
after_success:
18+
- docker exec http-middleware /bin/sh -c "php vendor/bin/php-coveralls -x clover.xml -o coveralls-upload.json"

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The contribution guideline is derived from the SlimPHP contribution guideline
66

77
1. Fork the Moon Http-Middleware repository
88
2. Create a new branch for each feature or improvement
9-
3. Send a pull request from each feature branch to the **develop** branch
9+
3. Send a pull request from each feature branch to the **master** branch
1010

1111
It is very important to separate new features or improvements into separate feature branches, and to send a
1212
pull request for each branch.

Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM composer:latest as composer
2+
FROM php:fpm
3+
4+
# Define ENVs and ARGs
5+
ARG XDEBUG_REMOTE_HOST=docker.for.mac.localhost
6+
ENV XDEBUG_CONFIGURATION_FILE='/usr/local/etc/php/conf.d/xdebug.ini'
7+
ENV OPCACHE_FILE=$PHP_INI_DIR/conf.d/opcache.ini
8+
9+
# Add the project to the container
10+
WORKDIR /moon
11+
ADD . /moon
12+
13+
# Install dependencies for PHP
14+
RUN apt-get update && \
15+
apt-get install -y git zlib1g-dev && \
16+
docker-php-ext-install zip
17+
18+
# Install dependecies (dev included)
19+
COPY --from=composer /usr/bin/composer /usr/bin/composer
20+
RUN composer install
21+
22+
# Install XDebug and add XDebug configurations
23+
RUN yes | pecl install xdebug
24+
RUN echo 'xdebug.idekey=MOON' >> $XDEBUG_CONFIGURATION_FILE && \
25+
echo 'xdebug.remote_enable=1' >> $XDEBUG_CONFIGURATION_FILE && \
26+
echo 'xdebug.remote_port=9090' >> $XDEBUG_CONFIGURATION_FILE && \
27+
echo 'xdebug.remote_connect_back=0' >> $XDEBUG_CONFIGURATION_FILE && \
28+
echo 'xdebug.remote_autostart=1' >> $XDEBUG_CONFIGURATION_FILE && \
29+
echo 'xdebug.remote_log="/var/log/xdebug/xdebug.log"' >> $XDEBUG_CONFIGURATION_FILE && \
30+
echo "xdebug.remote_host=$XDEBUG_REMOTE_HOST" >> $XDEBUG_CONFIGURATION_FILE && \
31+
echo ';;settings for profiling' >> $XDEBUG_CONFIGURATION_FILE && \
32+
echo 'xdebug.profiler_enable_trigger=1' >> $XDEBUG_CONFIGURATION_FILE && \
33+
echo 'xdebug.profiler_output_name=xdebug.out.%t' >> $XDEBUG_CONFIGURATION_FILE && \
34+
echo 'xdebug.profiler_output_dir="/tmp/xdebug"' >> $XDEBUG_CONFIGURATION_FILE && \
35+
echo 'xdebug.profiler_enable_trigger=1' >> $XDEBUG_CONFIGURATION_FILE && \
36+
echo 'xdebug.trace_enable_trigger=1' >> $XDEBUG_CONFIGURATION_FILE && \
37+
echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" >> $XDEBUG_CONFIGURATION_FILE
38+
39+
RUN mkdir /var/log/xdebug && chmod 0777 /var/log/xdebug

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Moon - HTTP Middleware
22

3-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/moon-php/http-middleware/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/moon-php/http-middleware/?branch=master)
4-
[![Code Coverage](https://scrutinizer-ci.com/g/moon-php/http-middleware/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/moon-php/http-middleware/?branch=master)
5-
[![Build Status](https://scrutinizer-ci.com/g/moon-php/http-middleware/badges/build.png?b=master)](https://scrutinizer-ci.com/g/moon-php/http-middleware/build-status/master)
6-
**Accpeted as [awesome psr-15 middleware](https://github.com/middlewares/awesome-psr15-middlewares#packages) package**
3+
[![Coverage Status](https://coveralls.io/repos/github/moon-php/http-middleware/badge.svg)](https://coveralls.io/github/moon-php/http-middleware)
4+
[![Build Status](https://travis-ci.org/moon-php/http-middleware.svg?branch=master)](https://travis-ci.org/moon-php/http-middleware)
5+
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
6+
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan)
77

88
## Official Documentation
99

@@ -34,4 +34,4 @@ If you discover security related issues, please email damianopetrungaro@gmail.co
3434

3535
## License
3636

37-
The Moon Http-Middleware is licensed under the MIT license. See [License File](LICENSE.md) for more information.
37+
The Moon Http-Middleware is licensed under the MIT license. See [License File](LICENSE) for more information.

composer.json

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,29 @@
55
"homepage": "https://www.moon-php.com/",
66
"require": {
77
"php": ">=7.1",
8-
"psr/http-message": "^1.0",
98
"psr/http-server-middleware": "^1.0",
109
"psr/container": "^1.0"
1110
},
1211
"require-dev": {
13-
"phpunit/phpunit": "^6.2",
14-
"phpspec/prophecy": "^1.7"
12+
"roave/security-advisories": "dev-master",
13+
"friendsofphp/php-cs-fixer": "^2.12",
14+
"damianopetrungaro/php-commitizen": "^0.1.2",
15+
"phpstan/phpstan": "^0.10.1",
16+
"php-coveralls/php-coveralls": "^2.1",
17+
"jangregor/phpstan-prophecy": "^0.2.0",
18+
"phpunit/phpunit": "^7.3"
19+
},
20+
"scripts": {
21+
"inspire": "curl -s https://favqs.com/api/qotd | json_pp | awk -F ':[ \t]*' '/^.*\"body\"/ {print $2}'",
22+
"fix": "@php vendor/bin/php-cs-fixer fix --config=.php_cs.dist",
23+
"tests": "@php vendor/bin/phpunit",
24+
"analyse": "@php vendor/bin/phpstan analyse src tests"
25+
},
26+
"scripts-descriptions": {
27+
"inspire": "Will print an inspiring quote",
28+
"fix": "Clean and optimize src and tests directories",
29+
"tests": "Run unit tests",
30+
"analyse": "Analyse project quality using PHPStan"
1531
},
1632
"authors": [
1733
{

0 commit comments

Comments
 (0)