• Stars
    star
    103
  • Rank 333,046 (Top 7 %)
  • Language
    PHP
  • Created about 4 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An example of an application built with Symfony 5, GraphQL and Nuxt.js

Symfony Boilerplate

Symfony Boilerplate

Documentation


This is a template of a README. Adapt it according to the comments and your needs.


Symfony Boilerplate

Replace this title and the following description with your project name and description.

A web application built with Nuxt.js 2, Symfony 5.4 (LTS), and GraphQL 5.

Setup

Prerequisites

Linux

Install the latest version of Docker and Docker Compose.

macOS

Consider installing Vagrant and VirtualBox.

Indeed, Docker currently has substantial performance issues on macOS, and using Vagrant allows us to have an almost Linux-like experience regarding performances.

Windows

Consider using a Linux-like terminal to run the Makefile commands. Vagrant might also be a solution regarding performances.

If not possible, you may also directly run the commands specified in the Makefile. For instance, instead of running make up, run docker-compose up -d.

Hosts

Update your hosts file with the following entries:

127.0.0.1   traefik.symfony-boilerplate.localhost
127.0.0.1   symfony-boilerplate.localhost
127.0.0.1   api.symfony-boilerplate.localhost
127.0.0.1   phpmyadmin.symfony-boilerplate.localhost
127.0.0.1   minio.symfony-boilerplate.localhost
127.0.0.1   mailhog.symfony-boilerplate.localhost

Update the domain with the one used in your project.

On Linux and macOS, run sudo nano /etc/hosts to edit it.

On Windows, edit the file C:\Windows\System32\drivers\etc\hosts with administrative privileges.

First start

Copy the file .env.dist to a file named .env. For instance:

cp .env.dist .env

Edit the .env.dist by updating the default values of DOMAIN, MYSQL_DATABASE and APP_SECRET environment variables.


Vagrant user

"Comment" the STARTUP_COMMAND_3 and STARTUP_COMMAND_4 environment variables from the api service in the docker-compose.yml file.

Next, run:

docker-compose up webapp api

📣  This command start the webapp and api service. While booting, these services install the JavaScript and PHP dependencies. We cannot do that directly in the Vagrant VM as yarn and composer install fail miserably the first time.

Once the services have installed the dependencies, you may stop them with:

CTRL+C
docker-compose down

Don't forget to uncomment the previous environments variables from the api service in the docker-compose.yml file.

Next, check there is no application running on port 80 (like Apache or another virtual machine).

If OK, run make vagrant, then vagrant up, and finally vagrant ssh to connect to the virtual machine. From here, you'll be able to run all the next commands like Linux users!

Update the variable VAGRANT_PROJECT_NAME from the .env and .env.dist files with your project name. Only use alphanumeric characters (no spaces, distinguish words with _ or -).


Next, make sure there is no application running on port 80 (Vagrant users can skip this check).

Good? You may now start all the Docker containers with the following commands:

make up

It may take some time as each container will also set up itself, such as installing dependencies (PHP, JavaScript, etc.), compiling sources (JavaScript), or running migrations to set up the database structure.

📣  In some cases, the api service will try to run the migrations before the mysql service is ready. If so, restart the api service with docker-compose up -d api.

The containers will be ready faster next time you run this command as the first run is doing most of the setup.

Once everything is ready, the following endpoints should be available:

Update the domain with the one used in your project.

You may now enter the api service and load the development data:

make api
php bin/console app:fixtures:dev
exit

Last but not least, start the message consumer with:

make consume

Cypress

We have added cypress for front-end testing, for now it is in webapp directory. It is recommended to remove it went deploy in production for security reasons:

Open cypress for testing

In the main directory

cd src/webapp
./node_modules/.bin/cypress open

What's next?

Configuring Git

Git should ignore globally some folders like those generated by your IDE and Vagrant.

If not already done, you should tell Git where to find your global .gitignore file.

For instance, on Linux/macOS/Windows git bash:

git config --global core.excludesfile '~/.gitignore'

Windows cmd:

git config --global core.excludesfile "%USERPROFILE%\.gitignore"

Windows PowerShell:

git config --global core.excludesfile "$Env:USERPROFILE\.gitignore"

Then create the global .gitignore file according to the location specified previously.

You may now edit it, according to your environment, with:

# IDE
.idea
.vscode
# MacOS
.DS_Store
# Vagrant
.vagrant

Documentations

Make sure you have read the following documentations:

Day-to-day guidelines

In-depth explanations

How to stop the stack?

As simple as the make up command, run make down to stop the entire Docker Compose stack.

If you're a Vagrant user, you may also stop the virtual machine with vagrant halt.

If you're not going to work on the project for a while, you may also destroy the virtual machine using vagrant destroy.

How to view the logs of the Docker containers?

All aggregated logs:

docker-compose logs -f

Logs of one service:

docker-compose logs -f SERVICE_NAME

For instance, if you want the logs of the api service:

docker-compose logs -f api

More Repositories

1

react-native-boilerplate

A React Native template for building solid applications 🐙, using JavaScript 💛 or Typescript 💙 (you choose).
TypeScript
4,775
star
2

safe

All PHP functions, rewritten to throw exceptions instead of returning false
PHP
2,360
star
3

docker-images-php

A set of PHP Docker images
HCL
774
star
4

graphqlite

Use PHP Attributes/Annotations to declare your GraphQL API
MDX
535
star
5

phpstan-strict-rules

A set of additional rules for PHPStan based on best practices followed at TheCodingMachine
PHP
273
star
6

kickoff-docker-php

🐳 🐘 🚀 Easily setup a PHP project with Docker
Shell
208
star
7

symfony-vuejs

Source code of the tutorial "Building a single-page application with Symfony 4 and Vue.js"
PHP
178
star
8

tdbm

The Database Machine is a PHP ORM that requires no configuration. The object model is deduced from the database model.
PHP
119
star
9

nodejs-installer

An installer package that let's you install NodeJS and NPM as a Composer dependency.
PHP
108
star
10

safe8

All PHP functions, rewritten to throw exceptions instead of returning false, now for php8
PHP
106
star
11

gotenberg-php-client

PHP client for the Gotenberg API
PHP
104
star
12

discovery

Publish and discover assets in your PHP projects.
PHP
101
star
13

phpstan-safe-rule

A PHPStan rule to be used with the thecodingmachine/safe package
PHP
55
star
14

best-practices

This repository contains the files to generate the http://bestpractices.thecodingmachine.com website
Less
53
star
15

mouf

The Mouf PHP framework: an open-source PHP framework providing an easy way to download, install, use and reuse components, with a graphical user interface.
PHP
50
star
16

gotenberg-go-client

Go client for the Gotenberg API
Go
47
star
17

gitlab-registry-cleaner

A simple Docker image to be used in Gitlab CI to easily delete images in the Gitlab registry
Shell
44
star
18

packanalyst

Packanalyst is a service that let's you browse in any PHP class / interface / trait defined in Packagist
JavaScript
35
star
19

graphqlite-bundle

A Symfony bundle for thecodingmachine/graphqlite.
PHP
34
star
20

dbal-fluid-schema-builder

Build and modify your database schema using Doctrine DBAL and a fluid syntax.
PHP
25
star
21

symfony-middleware

This package provides a StackPHP middleware that can be used to use a Symfony application as a middleware (instead of an app)
PHP
23
star
22

html.widgets.statsgrid

This PHP package contains a HTML pivot table. You provide it with a data set and the list of columns and rows and it will display a nice pivot table.
PHP
22
star
23

magic-query

A very clever library to use SQL prepared statement with a variable number of parameters... and much more!
PHP
22
star
24

redux-toolkit-wrapper

Redux-toolkit wrapper used to write less code regarding classic CRUD operations.
TypeScript
19
star
25

rnb-plugin-typescript

This plugin allow thecodingmachine react-native-boilerplate 🐙 users to translate the boilerplate from Javascript 💛 to Typescript 💙
TypeScript
18
star
26

yaml-tools

A set of CLI tools to manipulate YAML files (merge, edit, etc...)
Python
18
star
27

symfony-psr15-bridge

A bridge between Symfony middlewares (StackPHP) and http-interop middlewares for converting Symfony Http abstractions to PSR-15 and back.
PHP
17
star
28

graphqlite-laravel

A Laravel service provider package to help you get started with GraphQLite in Laravel.
PHP
16
star
29

picotainer

A minimalist PHP dependency injection container compatible with ContainerInterop
PHP
15
star
30

deeployer

A tool to ease the creation of environments using docker-compose or Kubernetes
PHP
14
star
31

whoops-stackphp

This package contains a StackPHP middleware that catches all exceptions and redirects those to the Whoops error handling library.
PHP
14
star
32

graphql-controllers

Write your GraphQL queries in simple to write controllers (using webonix/graphql-php).
PHP
12
star
33

database.tdbm

The Database Machine is a PHP ORM that requires no configuration. The object model is deduced at runtime from the database model.
PHP
11
star
34

silex-middleware

This package provides a StackPHP middleware that can be used to plug a Silex application
PHP
11
star
35

docker-images-nodejs

A set of Node.js Docker images
Shell
10
star
36

yaco

YACO (Yet Another COmpiler) is a PHP tool that generates a PHP container based on entry definitions.
PHP
10
star
37

classname-mapper

Provides a way to find in which PHP files a class will be looked upon.
PHP
10
star
38

class-explorer

Find the list of all your PHP classes and more.
PHP
9
star
39

drupal

This Composer package is an installer that will download Drupal from the http://drupal.org website and unpack it at the root of your Composer project.
9
star
40

print.service

PDF, docx, html generator service of docx or twig template
PHP
8
star
41

map-optimizer

A tool to automatically optimize a Tiled map for usage in Phaser 3
JavaScript
8
star
42

funky

Write service providers easily using annotations
PHP
7
star
43

csrf-header-check-middleware

A PHP PSR-15 (http-interop) compliant middleware that defends your application against CSRF attacks.
PHP
7
star
44

interop.silex.di

This project is a very simple extension to the Silex microframework. It adds to Silex the capability to use any DI container (not only Pimple).
PHP
7
star
45

tdbm-bundle

A Symfony bundle for TDBM.
PHP
6
star
46

schema-analyzer

A package that offers utility tools to analyze database schemas (on top of Doctrine DBAL)
PHP
6
star
47

utils.session.optimistic-session-handler

Session handler that releases session lock quickly. Usefull for multiple ajax calls on the same page
PHP
6
star
48

metahydrator

A configurable implementation of mouf's Hydrator interface
PHP
6
star
49

workadventure-map-forumphp

A WorkAdventure map for AFUP's ForumPHP 2020 event
HTML
5
star
50

crystal-project

This package contains the everaldo icon set. This is a set of icons that can be used in any web application.
5
star
51

splash-router

A PSR-15 compliant router using annotations
PHP
5
star
52

graphqlite-symfony-validator-bridge

Adds support for Symfony Validator in GraphQLite
PHP
5
star
53

alias-container

This package contains a really minimalist dependency injection container that can be used to create aliases of instances in existing containers.
PHP
5
star
54

docker-images-mysql

MySQL container with top-notch developer experience
Shell
4
star
55

workadventure-php-community-map

A map for the PHP community on WorkAdventure
JavaScript
4
star
56

service-provider-bridge-bundle

This Symfony Bundle enables Symfony applications to use service providers as defined in container-interop/service-provider
PHP
4
star
57

rnb-toolbox

Toolbox to create amazing plugins for our react-native boilerplate. 🧰
TypeScript
3
star
58

utils.common.conditioninterface

This package contains one interface for condition, and a few classes that implement it. A condition is a class that possesses an "isOk" method. The condition returns true if the condition is met, and false otherwise.
PHP
3
star
59

fluid-hydrator

PHP
3
star
60

DBFaker

Easy test data in your database !
PHP
3
star
61

gitlab-hook-middleware

A PSR-15 middleware to handle Gitlab hooks
PHP
3
star
62

archive-installer

This is a simple installer that let's you create simple Composer packages that are actually downloading and extracting an archive from the web.
PHP
3
star
63

laravel-universal-service-provider

This bridge allows Laravel applications to use service providers as defined in container-interop/service-provider
PHP
3
star
64

tdbm-laravel

A Laravel service provider package to help you get started with TDBM in Laravel
PHP
3
star
65

middleware-list-universal-module

Cross-framework module providing a service containing a list of middlewares
PHP
3
star
66

prefixer-container

This package contains a really minimalist dependency injection container that acts as a proxy in front of a target container. Its goal is to prefix all instances names in the target container.
PHP
3
star
67

swift-twig-mail-template

This package contains a utility class to render Swift mail messages using Twig for templating
PHP
3
star
68

database.doctrine-orm-wrapper

This package contains wrapper classes that make Doctrine ORM easy to use in Mouf
PHP
3
star
69

mvc.bce

BCE is made to make your live easy. It will help you in building forms very quickly, handles form rendering, both client and server-side validation, and persistance.
PHP
3
star
70

mvc.splash-common

The Core part of Splash (an MVC framework). It is used by Splash itself, but also by Drusplash (the Splash wrapper for Drupal)
PHP
3
star
71

mvc.splash

A MVC framework deeply integrated with Mouf
PHP
2
star
72

kickoff-docker-php-images

Base images of kickoff-docker-php
Roff
2
star
73

gitlab_scrutinizer_hook_adapter

This project is an adapter between Gitlab web hooks and Scrutinizer post-receive hook triggers
PHP
2
star
74

tom-cli

A dedicated CLI for TheCodingMachine React-Native Boilerplate !
JavaScript
2
star
75

graphqlite-universal-service-provider

Cross-framework module for GraphQLite using container-interop/service-provider
PHP
2
star
76

gitlab-registry-api

Library to use the Gitlab registry api in php
PHP
2
star
77

easy-entity-reader

This Drupal 8 module helps developers access entity content.
PHP
2
star
78

tdbm-graphql

A class generator that will generate GraphQL types from your database schema (using thecodingmachine/graphqlite)
PHP
2
star
79

k8s-gitlabci

PHP
2
star
80

utils.log.psr.multi-logger

This package contains a PSR-3 compatible logger that wrap a set of loggers
PHP
2
star
81

cache-utils

Store file related cache items easily
PHP
2
star
82

tdbm-graphql-bundle

A Symfony bundle for thecodingmachine/tdbm-graphql.
PHP
2
star
83

jquery.tcm.monthpicker

The jQuery TCM Monthpicker is a highly configurable plugin that adds monthpicker functionality to your pages. You can customize the date format and language, restrict the selectable date ranges and add in buttons and other navigation options easily.
2
star
84

html.tags

This package contains a pure PHP object representation of HTML5 tags. There is one class for each existing HTML tag, and one getter/setter per attribute.
PHP
2
star
85

integration.joomla.moufla-joomlaplugin

This is the plugin that integrate Mouf in a Joomla environment. There are two other repositories that are linked to this one.
PHP
1
star
86

lazy-array

This package provides an array than can lazily instantiate the objects it contains.
PHP
1
star
87

service-provider-utils

This package contains a set of tools to work with container-interop's service-providers.
PHP
1
star
88

common-factories

This project provides utility factories that can be used directly in service providers complying with the container-interop/service-provider standard.
PHP
1
star
89

container-discovery

Allowing discovery of container objects through Puli
PHP
1
star
90

quiz-demo-joomla

PHP
1
star
91

drupal-stratigility-bridge

This Drupal 8 module provides a bridge to include PSR-15 middlewares through Stratigility.
PHP
1
star
92

tdbm-hydrator

A PHP hydrator allowing easy mapping between an array and an object.
PHP
1
star
93

yaml-definition-loader

Provides a loader that can convert YAML files to container definitions compatible with the definition-interop standard.
PHP
1
star
94

security.daos.tdbm

This package contains a basic user/role/right database model for TDBM.
PHP
1
star
95

html.widgets.fileuploaderwidget

This package contains an upload widget based on File Uploader plugin. This allows easy uploading of files in AJAX or HTML5.
PHP
1
star
96

utils.graphics.mouf-imagine

Wrapper around the Imagine library, that allows to associate a set of Imagine Filters to an URL, like the LiipImagineBundle does for Symfony
PHP
1
star
97

forumphp2016demo

The PHP demo made for Paris Forum PHP 2016
PHP
1
star
98

utils.graphics.mouf-image

Images handler interface for resizing, croping, or any other action
PHP
1
star
99

html.html_element

This package contains the HtmlElementInterface interface that can be used to output HTML on a page. It also features base classes implementing this interface.
PHP
1
star
100

interop.symfony.di

This package contains an implementation of the Symfony 2 DI container that can be extended using other DI containers (from other frameworks).
PHP
1
star