Skip to content

Instantly share code, notes, and snippets.

@eerison
Last active October 24, 2025 12:44
Show Gist options
  • Select an option

  • Save eerison/78e1158ea624323139991814451bc55b to your computer and use it in GitHub Desktop.

Select an option

Save eerison/78e1158ea624323139991814451bc55b to your computer and use it in GitHub Desktop.
Symfony install
#!/bin/bash
# bash <(curl -fsSL https://gist.githubusercontent.com/eerison/78e1158ea624323139991814451bc55b/raw/sonata-page.sh)
#just to make sure the containers are running
docker compose up -d
docker compose exec -T php git config --global --add safe.directory /app
docker compose exec -T php composer config extra.symfony.allow-contrib true
docker compose exec -T php composer require sonata-project/page-bundle
#Migrations
docker compose exec -T php bin/console doctrine:migrations:diff
docker compose exec -T php bin/console doctrine:migrations:migrate --no-interaction
#Generate site default
yes | docker compose exec -T php bin/console sonata:page:create-site --enabled --name=localhost --locale=- --host=localhost --relativePath=- --enabledFrom=now --enabledTo=- --default
#Create a controller to be used as a hybrid page
docker compose exec -T php no | bin/console make:controller NiceHybridController
#Update routers and snapshots
docker compose exec -T php bin/console sonata:page:update-core-routes --site=1
docker compose exec -T php bin/console sonata:page:create-snapshots --site=1
#Make sure that assets was installed
docker compose exec -T php bin/console assets:install
xdg-open http://localhost:8000/admin
#!/bin/bash
# bash <(curl -fsSl https://gist.githubusercontent.com/eerison/78e1158ea624323139991814451bc55b/raw/symfony.sh) project-test 7.3.x
PROJECT_NAME="$1"
VERSION="$2"
#Install Symfony
echo "Project name: $PROJECT_NAME, Symfony version: $VERSION"
symfony new "$PROJECT_NAME" --version="$VERSION" --webapp
cd $PROJECT_NAME
#Copy docker files
curl -L https://github.com/shield-wall/easy-php-setup/archive/refs/heads/main.zip -o /tmp/main.zip
unzip /tmp/main.zip -d /tmp/
cp -r /tmp/easy-php-setup-main/.docker/ /tmp/easy-php-setup-main/docker-compose.yml ./
rm -rf /tmp/main.zip /tmp/easy-php-setup-main
# Remove old symfony files
rm compose.yaml compose.override.yaml
#Change symfony configs'
echo "DATABASE_URL=\"mysql://root:123456@database:3306/app?serverVersion=8.0.32&charset=utf8mb4\"" >> .env.dev
docker compose up -d
xdg-open http://localhost:8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment