Skip to content

Commit 68b5a88

Browse files
authored
Merge pull request #10 from sunrise-php/release/v3.0.0
v3.0.0
2 parents d1b72a2 + 48f1217 commit 68b5a88

File tree

75 files changed

+5636
-2542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+5636
-2542
lines changed

.circleci/config.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# PHP CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-php/ for more details
4+
#
5+
version: 2
6+
jobs:
7+
php74:
8+
docker:
9+
- image: circleci/php:7.4-cli-node-browsers
10+
steps:
11+
- checkout
12+
- run: php -v
13+
- run: cp .env.example .env
14+
- run: composer install --no-interaction --prefer-source --no-suggest
15+
- run: php vendor/bin/phpunit --colors=always
16+
php80:
17+
docker:
18+
- image: circleci/php:8.0-cli-node-browsers
19+
steps:
20+
- checkout
21+
- run: php -v
22+
- run: cp .env.example .env
23+
- run: composer install --no-interaction --prefer-source --no-suggest
24+
- run: php vendor/bin/phpunit --colors=always
25+
workflows:
26+
version: 2
27+
build:
28+
jobs:
29+
- php74
30+
- php80

.editorconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,5 @@ indent_size = 4
1111
trim_trailing_whitespace = true
1212
insert_final_newline = true
1313

14-
[*.md]
15-
trim_trailing_whitespace = false
16-
1714
[*.yml]
1815
indent_size = 2

.env.example

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,47 @@
1-
APP_ENV=dev
2-
APP_DISPLAY_ERRORS=1
1+
#
2+
# The application URL
3+
#
4+
# Must contain scheme, host and port (if not standard)
5+
#
6+
APP_URL="http://localhost:3000"
37

4-
DATABASE_URL="mysql://user:password@127.0.0.1:3306/acme"
8+
#
9+
# The application environment
10+
#
11+
# Use only the following values: dev, test, stage or prod
12+
#
13+
APP_ENV="dev"
514

15+
#
16+
# If set to 1, debug info will be logged
17+
#
18+
# In the production MUST be set to 0
19+
#
20+
APP_DEBUG=1
21+
22+
#
23+
# If set to 1, fatal errors will not be displayed
24+
#
25+
# In the production MUST be set to 1
26+
#
27+
APP_SILENT=0
28+
29+
#
30+
# Database server address to which you will write
31+
#
32+
DB_MASTER_URL="mysql://user:password@localhost:3306/acme?charset=utf8mb4"
33+
34+
#
35+
# Database server address from which you will read
36+
#
37+
# If replication is not configured, just duplicate the address of the master server
38+
#
39+
DB_SLAVE_URL="mysql://user:password@localhost:3306/acme?charset=utf8mb4"
40+
41+
#
42+
# Telegram logging
43+
#
644
TELEGRAM_URL="https://api.telegram.org"
7-
TELEGRAM_TOKEN=
8-
TELEGRAM_RECIPIENT=
9-
TELEGRAM_LEVEL=ERROR
10-
11-
CORS_DEBUG=1
12-
CORS_SERVER_ORIGIN_SCHEME=http
13-
CORS_SERVER_ORIGIN_HOST="127.0.0.1"
14-
CORS_SERVER_ORIGIN_PORT=3000
45+
TELEGRAM_TOKEN=""
46+
TELEGRAM_RECIPIENT=""
47+
TELEGRAM_LEVEL="ERROR"

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.php.dev linguist-language=PHP
2+
*.php.test linguist-language=PHP
3+
*.php.stage linguist-language=PHP
4+
*.php.prod linguist-language=PHP
5+
*.php.local linguist-language=PHP

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
/.down
12
/.env
23
/.php_cs.cache
4+
/.phpunit.result.cache
35
/.rr.yml
6+
/coverage.xml
47
/phpbench.json
58
/phpcs.xml
69
/phpunit.xml
10+
/cache/*
711
/config/definitions/*.php.local
812
/tests/db/*.sqlite
913
/vendor/
14+
!.gitkeep

.rr.yml.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ rpc:
33
http:
44
address: 0.0.0.0:3000
55
workers:
6-
command: "php bin/roadrunner-worker pipes"
6+
command: "php bin/worker-roadrunner pipes"
77
pool:
88
numWorkers: 4
9-
maxJobs: 0
9+
maxJobs: 1000

.scrutinizer.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
build:
2+
environment:
3+
php:
4+
version: '8.0'
5+
ini:
6+
'xdebug.mode': 'coverage'
27
nodes:
38
analysis:
49
tests:
510
override:
611
- php-scrutinizer-run
712
coverage:
813
tests:
14+
before:
15+
- command: cp .env.example .env
916
override:
1017
- command: php vendor/bin/phpunit --coverage-clover coverage.xml
1118
coverage:

.travis.yml

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

README.md

Lines changed: 107 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
## Awesome Skeleton for modern development on PHP 7.3+
1+
## Awesome Skeleton for modern development on PHP 7.4+ (incl. PHP 8)
22

3-
[![Build Status](https://scrutinizer-ci.com/g/sunrise-php/awesome-skeleton/badges/build.png?b=master)](https://scrutinizer-ci.com/g/sunrise-php/awesome-skeleton/build-status/master)
3+
> Contains quality tested packages, thoughtful structure and everything you need to develop microservices.
4+
5+
[![Build Status](https://circleci.com/gh/sunrise-php/awesome-skeleton.svg?style=shield)](https://circleci.com/gh/sunrise-php/awesome-skeleton)
46
[![Code Coverage](https://scrutinizer-ci.com/g/sunrise-php/awesome-skeleton/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/sunrise-php/awesome-skeleton/?branch=master)
57
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/sunrise-php/awesome-skeleton/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/sunrise-php/awesome-skeleton/?branch=master)
68
[![Total Downloads](https://poser.pugx.org/sunrise/awesome-skeleton/downloads?format=flat)](https://packagist.org/packages/sunrise/awesome-skeleton)
@@ -15,9 +17,23 @@
1517
composer create-project 'sunrise/awesome-skeleton:^3.0' app
1618
```
1719

20+
## Cooking
21+
22+
Set up your database connection:
23+
24+
```bash
25+
cp .env.example .env && nano .env
26+
```
27+
28+
Execute a migration:
29+
30+
```bash
31+
php bin/app migrations:migrate --service 'master' --no-interaction
32+
```
33+
1834
## Run CLI
1935

20-
> including: Doctrine DBAL, Doctrine ORM, Doctrine Migrations.
36+
> incl.: Doctrine DBAL, Doctrine ORM, Doctrine Migrations.
2137
2238
```bash
2339
php bin/app
@@ -35,10 +51,22 @@ composer serve
3551

3652
> listen 0.0.0.0:3000
3753
54+
Set up your server:
55+
56+
```bash
57+
cp .rr.yml.example .rr.yml && nano .rr.yml
58+
```
59+
60+
Run the server:
61+
3862
```bash
3963
rr -dv serve
4064
```
4165

66+
## Run via Swoole
67+
68+
> Coming soon...
69+
4270
## Run tests
4371

4472
```bash
@@ -53,9 +81,81 @@ composer bench
5381

5482
---
5583

84+
## Run routes through cURL
85+
86+
> you may need to change the server address...
87+
88+
#### Home (index)
89+
90+
```bash
91+
curl -X 'GET' 'http://127.0.0.1:3000/'
92+
```
93+
94+
#### OpenAPI document
95+
96+
```bash
97+
curl -X 'GET' 'http://127.0.0.1:3000/openapi'
98+
```
99+
100+
#### Create an entry (example bundle)
101+
102+
```bash
103+
curl -X 'POST' -H 'Content-Type: application/json' -d '{"name": "foo", "slug": "foo"}' 'http://127.0.0.1:3000/api/v1/entry'
104+
```
105+
106+
#### Update an existing entry (example bundle)
107+
108+
> you need to set an existing ID.
109+
110+
```bash
111+
curl -X 'PATCH' -H 'Content-Type: application/json' -d '{"name": "foo", "slug": "foo"}' 'http://127.0.0.1:3000/api/v1/entry/b06fd41d-d131-4bb9-a472-eb583369437c'
112+
```
113+
114+
#### Delete an existing entry (example bundle)
115+
116+
> you need to set an existing ID.
117+
118+
```bash
119+
curl -X 'DELETE' 'http://127.0.0.1:3000/api/v1/entry/b06fd41d-d131-4bb9-a472-eb583369437c'
120+
```
121+
122+
#### Read an existing entry (example bundle)
123+
124+
> you need to set an existing ID.
125+
126+
```bash
127+
curl -X 'GET' 'http://127.0.0.1:3000/api/v1/entry/b06fd41d-d131-4bb9-a472-eb583369437c'
128+
```
129+
130+
#### List of entries (example bundle)
131+
132+
```bash
133+
curl -X 'GET' 'http://127.0.0.1:3000/api/v1/entry'
134+
```
135+
136+
---
137+
56138
## Useful commands
57139

58-
#### Generate Systemd unit file for RoadRunner
140+
#### Deploy
141+
142+
```bash
143+
bash bin/deploy
144+
```
145+
146+
#### Down
147+
148+
```bash
149+
bash bin/down 'Reason...'
150+
```
151+
152+
#### Up
153+
154+
```bash
155+
bash bin/up
156+
```
157+
158+
#### Generate Systemd unit for RoadRunner
59159

60160
```bash
61161
php bin/app app:roadrunner:generate-systemd-unit > app.service
@@ -64,24 +164,23 @@ php bin/app app:roadrunner:generate-systemd-unit > app.service
64164
#### Generate OpenApi document
65165

66166
```bash
67-
php bin/app app:openapi:generate-documentation --pretty > openapi.json
167+
php bin/app app:openapi:generate-document > openapi.json
68168
```
69169

70170
---
71171

72172
## Used stack
73173

174+
> see composer.json
175+
74176
* https://github.com/PHP-DI/PHP-DI
75177
* https://github.com/Seldaek/monolog
76178
* https://github.com/sunrise-php/http-router
77179
* https://github.com/doctrine/orm
78180
* https://github.com/doctrine/migrations
79181
* https://github.com/symfony/console
80182
* https://github.com/symfony/validator
81-
* https://github.com/neomerx/cors-psr7
82183
* https://github.com/justinrainbow/json-schema
83-
* https://github.com/filp/whoops
84-
* https://github.com/twigphp/Twig
85184

86185
## Used technology
87186

bin/app

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,4 @@ $application->addCommands(
1616
$container->get('commands')
1717
);
1818

19-
$application->addCommands(
20-
$container->get('doctrine')->getCommands()
21-
);
22-
2319
$application->run();

0 commit comments

Comments
 (0)