reactive-apps / skeleton
Reactive Apps Skeleton
Requires
- php: ^7.3
- brunty/cigar: ^1.11
- php-di-definitions/react-event-loop-inspected: dev-master
- php-di-definitions/twig: dev-master
- reactive-apps/app: dev-master
- reactive-apps/command-bunny-consumer: dev-master
- reactive-apps/command-http-server: dev-master
- reactive-apps/command-metrics: dev-master
- reactive-apps/command-supervisor: dev-master
- roave/security-advisories: dev-master
- vlucas/phpdotenv: ^4.0
- wyrihaximus/react-http-middleware-measure: dev-master
- wyrihaximus/react-http-middleware-with-headers: ^1.0
- wyrihaximus/react-inspector-child-process-pools: dev-master
- wyrihaximus/react-inspector-cpu-usage: dev-master
- wyrihaximus/react-inspector-http-middleware-measure: dev-master
- wyrihaximus/react-inspector-memory-usage: dev-master
Requires (Dev)
- api-clients/test-utilities: ^5.0
- seregazhuk/php-watcher: ^0.5.2
This package is auto-updated.
Last update: 2024-10-29 05:34:35 UTC
README
Create a new project based on this skeleton
The following command will create a new project based on this skeleton in the your-project-name
directory:
composer create reactive-apps/skeleton your-project-name
Before you get started
Copy the .env.example
to .env
and adjust where needed. Make sure to match the post of REACT_HTTP_SOCKET_ADDRESS
with the post in cigar.json
.
Usage
This skeleton comes with a set of make
commands to ease the QA and development. Running make
will do a full QA run
including linting
, code style checks
, unit tests
, and smoke testing
.
This is a fully command line based tool with it's own HTTP
server build in. Running ./app
will list the available
commands. For example ./app http-server
will start. It is also possible to run multiple commands at once, for example
the following runs the HTTP
server, metrics collection, and internal cron (the latter two aren't included by default):
./app multi metrics cron http-server
.
Docker Compose
Alternatively there is make dev
that will boot up a full dev environment using docker-compose
that includes:
- Running this app with the HTTP server available on
localhost:54321
(host might differ on non-Linux platforms) Grafana
onlocalhost:3000
with user/passwordadmin
/admin
for application, system and services metricsGraphite
/InfluxDB
for metrics storage and feeding them toGrafana
Telegraf
gathering metrics pushing them toGraphite
/InfluxDB
RabbitMQ
for message consumer in your app but also used for getting metrics from the app toTelegraf
Logging
The app is by default shipped with Monolog
for logging and STDOUT
logging for
colour logging to the command line. Any additional handlers and processors can be configured in the etc/config/logger.php
configuration file. The http-server.php
next to it also shows off how it can be used together with DI.
HTTP Server
The HTTP
server command looks at composer.json
to find configured controllers and sets those up for when requests
come in. A controller can be both static and instanced. With the latter useful for when you need to do more then the
basics where no injected dependencies are required. The configuration is done through annotations for the allowed
HTTP
method and route. The HTTP server documentation can be found here.
License
The MIT License (MIT)
Copyright (c) 2019 Cees-Jan Kiewiet
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.