Code Monkey home page Code Monkey logo

symfony-boilerplate's Introduction

symfony-boilerplate

Docker container to get started with Symfony 2.7 LTS and much more.

What's inside

  • PHP 5.6
  • Symfony 2.7 LTS
  • Nginx
  • Node.js / NPM
  • MySQL
  • Redis
  • Elasticsearch
  • Blackfire Profiler
  • Gulp.js
  • Bower

Gulp.js build system

  • Browserify (incl. Babel.js ES6 transpiler)
  • SASS compilation
  • Automatic file watcher

Prerequisites

Install Docker on your system.

Install Docker Compose on your system.

Optionally, I suggest that you use docker-machine for managing your Docker hosts.

Get up and running

  1. Download or clone this repository

    $ git clone https://github.com/b00giZm/symfony-boilerplate.git
  2. Copy app/.env.example to app/.env so Docker (and later Symfony) can use it.

    $ cd code/symfony-boilerplate; cp app/.env.example app/.env
  3. Build your Docker development container container: It will pull a base image from the Docker registry and install all necessary dependencies (This might take a while, depending on your host system).

    $ docker-compose build
  4. Create and start the main Docker container and attach all linked containers. For your very first run, this will also take a while, because docker-compose first needs to pull the images for all linked containers.

    $ docker-compose up -d
  5. Install PHP dependencies through Composer, which you installed during step 1.

    $ docker-compose run --no-deps web composer update
  6. Install Node.js dependencies through npm, which you did also install during the first step.

    $ docker-compose run --no-deps web npm install
  7. Install frontend components through Bower, which you did also install during the first step.

    $ docker-compose run --no-deps web bower install
  8. Build all frontend Javascripts and CSS files, contained in the FrontendBundle, with Gulp.js and watch file changes for automatic rebuilds.

    $ docker-compose run --no-deps web gulp

    What it does:

    • It compiles all SASS stylesheets inside src/FrontendBundle/Resouerces/public/sass to CSS.
    • It compiles Javascripts inside src/FrontendBundle/Resouerces/public/lib with Browserify. You can use ES6 and ES7 syntax and features, if you want. Browserify takes care of compiling everyhing to 100% browser compatible Javascript.
  9. You can then access the app, which should then be running on your docker daemon on HTTP port 8000 (On OS X you can use docker-machine env dev to find out the IP address). For convenience, I created a localdocker.dev entry in my /etc/hosts which points to that IP.

    $ open http://localdocker.dev:8000/app_dev.php

symfony-boilerplate

Now go and build something awesome! ๐Ÿ™

Alternative Way

Instead of running steps 5) to 8) as docker-compose on/off commands, you can run them directly inside the container:

$ docker-compose run --no-deps web bash
root@ee746ce03589:/code/app $ composer update
...
root@ee746ce03589:/code/app $ npm install
...
root@ee746ce03589:/code/app $ bower install
...
root@ee746ce03589:/code/app $ gulp watch

This really is my preferred way, because it involves less typing and it feels more "natural", because you may need to initiate several commands via the CLI on a regular base (creating class skeletons, running database migrations etc.)

Blackfire.io Support

If you want to use the Blackfire profiler, we got you covered as well. Just fill in your Blackfire credentials in app/.env (after you copied it from app/.env.example) and you're good to go.

BLACKFIRE_SERVER_ID=YourBlackfireServerID
BLACKFIRE_SERVER_TOKEN=YourBlackfireServerToken
BLACKFIRE_CLIENT_ID=YourBlackfireClientID
BLACKFIRE_CLIENT_TOKEN=YourBlackfireClientToken
BLACKFIRE_LOG_LEVEL=4

Maintainer

Pascal Cremer

License

The MIT License (MIT)

Copyright (c) 2015 Pascal Cremer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

symfony-boilerplate's People

Contributors

b00gizm avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

symfony-boilerplate's Issues

Make the symfony app a fork of the standard edition and a submodule

Hey,

First of all, it's a good initiative thanks for doing it.

I think it would be better if the Symfony app contained in the boilerplate is a fork of the standard edition as it would help track the updates and merge them easily in the customized version. It would also help choosing which Symfony version you want to use in the future.

Also, as the customized Symfony app can be a standalone project, it probably should exist in a different git repository and link to this one via git submodule. It would allow a better decoupling.

What's your thoughts on this?

error 502

Pascal this is a good repo.
I have for some time now neglected php, now it seems I brush my symfony quick. Running things on docker container is the most sane way to do it. Your boilerplate offers something very interesting.

The thing is, the containers build and runs well except i can not access the web app, I nginx gives me 502. What could not be right. The only thing that gave some worry output was running compser update
composer update

And here is nginx
502_bad_gateway

What could be wrong here?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.