skip to content

Automating the creation of new Symfony 1.4 projects

A way to start quickly Symfony 1.4 projects with git

Sometimes I want to create new Symfony projects to try something, or, well, sometimes even to do some actual work.

Then, I go to the Jobeet tutorial and follow the first steps. After that, since I use git, I check out this post to setup symfony as a submodule.

I have written a simple bash script with that post and a few more lines, to automatize the process. It may be useful for others, and for me to have it accesible, so I will post it here:



if [ -z ";$DBPASS"; ]; then
 echo edit to add your mysql password on line 4: DBPASS=\";password\";

if [ -z ";$1"; ]; then
 echo usage: $0 project name

mkdir $1
cd $1

git init
git submodule add $SYMFREPO $VENDOR_DIR/

git submodule foreach 'git submodule init && git submodule update'

git commit -m 'Initial commit; initialized Symfony-git (1.4)'

$VENDOR_DIR/data/bin/symfony generate:project $1
echo ";config/databases.yml"; &> .gitignore
echo ";cache/*"; &>&> .gitignore
echo ";log/*"; &>&> .gitignore

./symfony project:permissions
git add .
git commit -m 'Initialized Symfony project'

./symfony generate:app frontend
git add .
git commit -m 'Initialized frontend application'

mysqladmin -u$DBUSER -p$DBPASS create $1
./symfony configure:database ";mysql:dbname=$1;hostname=localhost"; $DBUSER $DBPASS

usage:  ./ name_of_the_new_project

remember to write your database password in the line 4 of the script.

Edit: updated to include the changes proposed by kbsali. Thanks!

Edit2: I have posted it in a gist.