I have a web application made with Symfony2 and I want to add my license choice in the repository. The thing is that the default Symfony2 project has a LICENSE file in the root directory and I don't know where I am supposed to put my LICENSE file and if I should delete the Symfony2's one. Also happens with README file.
I guess that you Symfony2 programmers sure know how to handle this.
Your own application code should be located mostly in the src folder. If you take a look at some Bundles or other components of Symfony2 you can see that they all have a separate LICENSE file in their bundle root directory. So the correct choice for your file would be:
src/.../.../LICENSE
In this case your LICENSE file would also be included if you install your bundle via composer on a different project. In that case it would be at:
vendor/.../.../LICENSE
Related
I always thought symfony is one of the best PHP Framework because it uses bundles : all files are grouped in the bundle folder : views, controller, assets, so I can create severals web sites with one symfony installation (like Wordpress Multi-site) ... But I found this in the official documentation :
Best Practice : Store your assets in the web/ directory.
It means files are no more grouped ! Can some one explain me what are the advantages ?
I also read Sensio will perhaps no longer use bundles !! Why ???
If the assets are bundle specific, you can use then under the bundle. web directory is the end-user facing root and referencing assets in an website / API from your bundle to the end-user is not suggested from security point of view.
So, even if you have your assets under Resources/public/ directory. You have to run the command asset:install to install those assets to web/bundles directory. This will help the bundle to make compatible with plug and play feature across the application.
I was planning to use Sass with my Spring-MVC application. From Sass-lang website I got this Maven LibSass Plugin. I have put it in my pom.xml
But I am really confused with what next?
The major doubts I have are:
Which directory I should keep my Sass files in?
How do I include them in my HTML files?
What should be the target dir?
As of now, if I keep directories as suggested by my plug-in, it crashes either eclipse or stalls maven clean and install goal execution. I very new to this concept. Do let me know if you need any other info.
Actually these are all up to you.
You can choose an arbitrary directory. Most probably you would not want to serve Sass files. Thus this directory should not be deployed. libsass examples use src/main/sass directory.
You should include the .css files created at the target directory manually. libsass does not handle this part. There is no automatic inclusion of the compiled .css files as in Ruby on Rails platform.
Target directory is arbitrary again. Remember the choice of directory depends on how you will refer to these files at views. For example if you will be manually referring them, most probably you'll want to specify a target directory that is actually deployed to application server, such as src/main/resources/css.
What do I use as the autoload file for my PHP Unit configuration file for my contributed bundle?
I'm writing unit tests for my first contributed Symfony 2 bundle. I'm not sure how to handle the XML configuration file phpunit.xml.dist for PHP Unit. I know I should write my own config file(instead of relying on the one provided by Symfony Framework), but I've seen a few different ways people handle the bootstrap file that the config uses.
Symfony framework apps have a PHP Unit config file in the app/ folder and it uses bootstrap.php.cache as the autoloader, which really just defers to the composer autoloader in the vendor directory.
Several bundles I've looked at have their own bootstrap file but try and locate some other autoload file on the filesystem, making assumptions about where it may be. That doesn't seem right to me, but perhaps it is?
The best practices don't get into specifics here.
Best practices for unit testing is to test a small unit of functionality at a time, this unit should not rely on external influences and doesn't make sense to use bootstrap.php.cache as that is intended to bootstrap the entire symfony framework.
Your tests within a bundle should be able to execute on their own if someone were to checkout your bundle and contribute to it, they should be able to run tests there with only your code and dependencies. An ideal scenario would be that no bootstrap is necessary to set up the test suite, all you need is the autoloader. This is why many bundles have a bootstrap script that loads the autoloader.
There are two scenarios on the autoloader location relative to the bundle, either your bundle is installed standalone and it will be in vendor/autoload.php or your bundle is installed as a dependency, which in a standard configuration would you would fall back to a project autoloader if that exists.
This is variable depending on your setup and usage of target dir... You would need to traverse upward at least two levels to account for vendor name and package name, then if you have a target directory configuration you would need to traverse upwards the number of directories in your target path.
I am new to Symfony 2 and there is something I would like to know..
It looks like you have to put your static resources to this location: MyBundle/Resources/public
but if I want to use twig functions like asset, it is good if resources are at this location: web/MyBundleName/
Why do I have to duplicate my resources ? (one in the src/MyBundle/Resources/public and the other one in web/MyBundle)
Run app/console assets:install web to copy resources from the activated bundles to the web/bundles folder.
This is not a duplication. The web/bundles folder is the place where all the assets from all the bundles are being installed to. The folder should be ignored by your VCS.
The reason for this approach is that 3rd party bundles — and the reusable bundles you'll create later — don't have access to the web folder of an application. Installing assets with the command solves this problem.
I want to deploy a web role on Windows Azure. The project contains a large resource file (in fact, a dictionary file with extension .dct).
After packaging with vs2010, I investigate the .cspkg file, no .dct files are included in the approot sub-directory. What may be the problem and how to solve?
Thanks and best regards!
You need to set it to Copy Local in the files properties. See this screenshot:
Edited to add: According to #Summer_More_More_Tea it wasn't the Copy Local property but rather setting the Build Action to 'Content', which specifies the file is not compiled but is included in the output.