Viewed   157 times

We're considering creating our own common bundle for entity mapping and services for use within few separate apps. A bundle should be easy to modify, run, include and test. I know about Best Practices for Structuring Bundles, but I don't know what git strategy to use when it comes to development.

Should we create common bundle as a whole project and commit whole repository to our git server, or is it better to start source control only for root of common bundle and push only its contents? I see this approach in bundles available on github, but I don't know easy and comfortable way to develop bundles that way.



Create a new empty symfony project

php composer.phar create-project symfony/framework-standard-edition demo/ 2.4.1
cd demo

Generate a new bundle

(for example src/Company/DemoBundle)

php app/console generate:bundle
cd src/Company/DemoBundle/

Init your github repository in src/Company/DemoBundle

git init
git add .
git commit -m "initial commit"
git remote add origin
git push -u origin master

Add a composer.json file


    "name" : "company/demobundle",
    "description" : "A demo bundle",
    "type" : "symfony-bundle",
    "authors" : [{
        "name" : "demo",
        "email" : ""
    "keywords" : [
        "demo bundle"
    "license" : [
    "require" : {
    "autoload" : {
        "psr-0" : {
            "Company\DemoBundle" : ""
    "target-dir" : "Company/DemoBundle",
    "repositories" : [{
    "extra" : {
    "branch-alias" : {
            "dev-master" : "some_version-dev"

Now you have the base structure of your bundle

Use it in another project


    "require" : {
        "company/demobundle" : "dev-master"
    "repositories" : [{
        "type" : "vcs",
        "url" : ""


curl -sS | php
php composer.phar update company/demobundle


new CompanyDemoBundleCompanyDemoBundle(),

Work on it

  • You can clone your DemoBundle in the src/Company folder, then manually install it
  • You can use symlink


You can develop and test your bundle in your first project and use it with github and composer in your second project.

Sunday, December 11, 2022

You can use $this->path. It returns the same result as __DIR__

Tuesday, December 27, 2022

Few months later, but here is what helped me.

I put the path to wkthmltopdf folder in escaped double quotes.

      binary: ""C:/Program Files (x86)/wkhtmltopdf/wkhtmltopdf.exe""
Thursday, August 4, 2022

You can just add the whole project to the staging area (tracking), view the changes comparing to your remote repository, and then unstage the added files.

git init
git remote add origin {origin_URL}
git fetch --all
# stage files
git add .
git --no-pager diff -R origin/master --numstat
# unstage them
git reset
Tuesday, November 8, 2022

I'm having exactly the same problem, but instead of relaunching Xcode I'm just re-selecting Deployment Target in Summary tab in target options. This is much faster.

Friday, October 21, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :