2017 © Pedro Peláez
 

project skeleton

image

4xxi/skeleton

  • Thursday, July 5, 2018
  • by etomilin
  • Repository
  • 8 Watchers
  • 51 Stars
  • 87 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 8 Versions
  • 30 % Grown

The README.md

4xxi Symfony Skeleton

4xxi Symfony Skeleton is an extension for the official Symfony Skeleton (recommended way for starting new projects using Symfony Flex). It's main idea is to keep simplicity of official Skeleton, while adding must-have dependencies and default configs used in 4xxi for developing majority of the projects. It contains bare Symfony Skeleton with the following additions:, (*1)

  • A minimal set of must-have bundles for production environment
    • ORM Pack (Doctrine + Migrations)
    • FrameworkExtraBundle (Annotations)
    • MonologBundle
    • Sensiolabs SecurityChecker
  • A set of bundles and tools that are necessary for development
  • Docker Compose and Docker Sync configs optimized for development under Linux and MacOS
  • Template for README.md with installation instructions

Creating new project

Creating new project with 4xxi Symfony Skeleton is as easy as running, (*2)

composer create-project 4xxi/skeleton <project_name> 

where <project_name> is the directory where you want to setup a new project. New project is ready for development immediately after this step., (*3)

Additional configurations

Docker

4xxi Symfony Skeleton comes with Docker configuration for local development (includes PHP 7.1, nginx and PostgreSQL) on Linux and MacOS., (*4)

  • Follow instructions in docker-sync.yml and docker-compose-sync.yml and update project_name-data-sync volume with the real name of your project. This is needed to keep a unique name for data volume used by Docker Sync for developers working simultaneously on several projects.
  • Optional: Add additional PHP extensions to PHP Docker container by following instructions in config/docker/php/Dockerfile.
  • Optional: Add additinal services (like Redis, RabbitMQ, Elasticsearch) in docker-compose.yml.

Add Bundles and dependencies that are required by our project

Projects created by Flex include only the mininum amount of dependencies by default. Most of additional components that were previously a part of Symfony Standard Edition are not installed, so it is up to you to install them if they are really needed., (*5)

Most of components could be installed and auto-configured by Flex by running:, (*6)

composer req <component>

The list of common Components that may be needed for the project:, (*7)

  • api
  • asset
  • twig
  • workflow
  • web-link

Update installation instructions

When you are done with previous steps, update Installation Instructions and remove everything above them in this file., (*8)

Installation Instructions

Everything below is a template for Installation Instructions. It should be updated with the full steps for setting up your project., (*9)

Requirements

Configuration

Application configuration is stored in .env file., (*10)

Run cp .env.dist .env to apply the default configuration for local installations., (*11)

HTTP port

If you have nginx or apache installed and using 80 port on host system you can either stop them before proceeding or reconfigure Docker to use another port by changing value of EXTERNAL_HTTP_PORT in .env file., (*12)

Application environment

You can change application environment to dev of prod by changing APP_ENV variable in .env file., (*13)

DB name and credentials

DB name and credentials could by reconfigured by changing variables with POSTGRES prefix in .env file. It is recommended to restart containers after changing these values (new database will be automatically created on containers start)., (*14)

Installation

1. Start Containers and install dependencies

On Linux:, (*15)

docker-compose up -d

On MacOS:, (*16)

docker-sync-stack start

2. Run migrations, install fixtures

docker-compose exec php bin/console doctrine:migrations:migrate

3. Build frontend

Place instructions to build frontend here., (*17)

4. Open project

Just go to http://localhost, (*18)

Application commands

Add application-specific console commands and their description here., (*19)

Useful commands and shortcuts

Shortcuts

It is recommended to add short aliases for the following frequently used container commands:, (*20)

  • docker-compose exec php php to run php in container
  • docker-compose exec php composer to run composer
  • docker-compose exec php bin/console to run Symfony CLI commands
  • docker-compose exec db psql to run PostgreSQL commands

Checking code style and running tests

Fix code style by running PHP CS Fixer:, (*21)

docker-compose exec php vendor/bin/php-cs-fixer fix

Run PHP Unit Tests:, (*22)

docker-compose exec php bin/phpunit

The Versions