0

I'm currently working on a project where we use Symphony to build an application that is going to be a library for other PHP projects.

We want to install Symfony and manage all dependencies through Composer. The structure we're after will look something like this:

/
  composer.json
  /Symfony
    /src
    /app
  /vendor
    /symfony
    /doctrine

The vendor directory would not be committed to source control since it's contents are generated by Composer. The Symfony directory would be our application source directory but if possible we prefer to have the src and app directories sit directly in the root next to the composer.json.

Since we want/need to create a bundle for our application (for ORM entities etc.) and we can't place any of this in the vendor directory the question basically is;

a) is this possible?

b) are there any resources out there to set up a structure like this?

2
  • what is exactly your problem? I don't fully understand your question. Do you want to remove the Symfony directory and have src and app in the route? Or is the structure you how now the structure you want? And using a framework for a library seems wrong to me... Commented May 13, 2013 at 7:30
  • I want to separate the framework from my application. Symfony is a vendor to my app and therefore lives in the vendor folder. Nothing in the vendor folder should be changed/modified since its generated by Composer. How do I tell Symfony to find my source of my application code in a different location other than the standard way of adding it IN the framework? Commented May 13, 2013 at 11:01

1 Answer 1

1

Take a look at the default directory structure after a fresh install. It's exactly what you want! Don't know, what you or your devs were doing, that you got a Symfony folder next to composer.json

Everything you code lives under the src/ dircetory next to composer.json
Everything you configure lives under the app/config/ directory.
Nothing lives in the symfony framework itself, but it will depend on symfony.

EDIT: Installing the symfony standard edition with composer:

php composer.phar create-project symfony/framework-standard-edition path/ 2.2.1

And this is the result:

/path/to/symfony
+---- app/           # The app directory where the configuration and autoloader lives
+---- bin/           # Binaries, don't ask me ;)
+---- composer.json  # Your dependency management
+---- composer.lock  # Your version lock file
+---- LICENSE        # License file
+---- README.md      # You should read this
+---- src/           # Where YOUR CODE and your bundles lives!
+---- UPGRADE-2.2.md # Upgrade infos 
+---- UPGRADE.md     # Upgrade infos
+---- vendor/        # The vendor directory, where the symfony components and bundles,
|                    # as other bundles and libraries are. Not for VCS.
+---- web/           # web files, should be the DocumentRoot of the webserver.
Sign up to request clarification or add additional context in comments.

2 Comments

When I install Symfony through Composer I get Symfony in the vendor directory, that's it. You need to be more specific.
Look at my edit. The symfony folder in the vendor directory is normal, 'cause it's the symfony framework itself, but not your code. Your code/bundles has to be under source. Please take a look at the excellent documentation!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.