GitHunt
JO

jonathangomes17/php-the-flash-app

Application responsible for generating the basics necessary to develop a Web application

The Flash App

Application responsible for generating the basics necessary to develop a Web application

Maintainability

Table of Contents

Objective

  • High performance
  • Boilerplate with master class application
  • MVC + DDD architecture focused on small applications, with very low cost

Requirements

  • Docker
  • Node 13.*
  • Composer

Resources

  • PHP

    • Fast Route (Controllers and Handlers)
    • JWT (Bigger Security of session user)
    • Event Dispatcher (Events and Subscribers)
    • Symfony/Console (Routines of cron)
    • Phinx (Commands of manipulation database)
    • Swift Mailer (Mail dispatcher)
    • Sentry (Monitoring errors)
    • DotEnv (Environments)
    • Illuminate/Database (ORM)
    • Twig Template (View layer)
  • TypeScript

  • Webpack

  • SASS

  • Docker

    • MySQL
    • MySQL Adminer
    • Apache
    • PHP 7.2

Setup

Docker

sh .bin/exec.sh

Front-End

Executing changes css and js

npm run watch

Build assets

npm run build

Phinx

Migration

Create a new migration

docker exec theflashapp_php vendor/bin/phinx create TestMigration

Runing all migrations

docker exec theflashapp_php vendor/bin/phinx migrate -e production

Seed

Create a new seeder

docker exec theflashapp_php vendor/bin/phinx seed:create TestSeed

Runing all seeders

docker exec theflashapp_php vendor/bin/phinx seed:run -e production

Runing initial application

docker exec theflashapp_php vendor/bin/phinx seed:run -s User -s Role -s UserRole -s Action -s RoleAction -e production 

Events

Triggers that run in the background without affecting the user experience

  • Enable the fastcgi_finish_request feature for a better api experience
  • If not enabled, all events will be triggered at run time
  • Example with three events localhost:4000/api/v1/test/events

Token

Manages access to your application

Retrieve token

  • Util route for generate token per environment localhost:4000/api/v1/util/token

    • iss - Issuer app
    • exp - Expiration time token (the value informed above is to never expire). When not informed or null search in the environment JWT_EXPIRATION
    • secret_key - The unique signature of your token for added security. When not informed or null search in the environment JWT_KEY
    • algorithm - Generate token with base in algorithm. When not informed or null search in the environment JWT_ALGORITHM
    • retrieve_token - Is used to ensure end-to-end between applications, in case leave it empty.

    Example:

    {
      "iss": "The Flash App",
      "exp": 317125598072,
      "secret_key": null,
      "algorithm": null,
      "retrieve_token": null
    }
  • After the response json, update your .env file with the new information, the ideal would be JWT_RETRIEVE_TOKEN or even JWT_KEY, but ensure that no user is accessing it at this time, but in the event it is logged out

Session token

It is generated in the api/v1/auth route based on the environment variables JWT_RETRIEVE_TOKEN, JWT_EXPIRATION, JWT_KEY and JWT_ALGORITHM

Contributors

  1. Jonathan Alves Gomes

Languages

PHP71.4%TypeScript8.6%Twig7.6%SCSS6.9%JavaScript3.4%Dockerfile1.4%Shell0.7%

Contributors

Created January 7, 2016
Updated February 14, 2021