创建一个新的空symfony项目
php composer.phar create-project symfony/framework-standard-edition demo/ 2.4.1cd demo
产生一个新的捆绑包
(例如
src/Company/DemoBundle)
php app/console generate:bundlecd src/Company/DemoBundle/
在以下位置初始化您的github存储库 src/Company/DemoBundle
git inittouch README.mdgit add .git commit -m "initial commit"git remote add origin https://github.com/YourAccount/DemoBundle.gitgit push -u origin master
添加一个composer.json文件
src/Company/DemoBundle/composer.json:
{ "name" : "company/demobundle", "description" : "A demo bundle", "type" : "symfony-bundle", "authors" : [{ "name" : "demo", "email" : "demo@company.com" }], "keywords" : [ "demo bundle" ], "license" : [ "MIT" ], "require" : { }, "autoload" : { "psr-0" : { "Company\DemoBundle" : "" } }, "target-dir" : "Company/DemoBundle", "repositories" : [{ }], "extra" : { "branch-alias" : { "dev-master" : "some_version-dev" } }}现在您有了捆绑包的基本结构
在另一个项目中使用
composer.json:
[...] "require" : { [...] "company/demobundle" : "dev-master" }, "repositories" : [{ "type" : "vcs", "url" : "https://github.com/Company/DemoBundle.git" }], [...]做:
curl -sS https://getcomposer.org/installer | phpphp composer.phar update company/demobundle
app / AppKernel:
new CompanyDemoBundleCompanyDemoBundle(),
在…上下功夫
- 您可以在
src/Company
文件夹中克隆DemoBundle ,然后手动安装 - 您可以使用符号链接
结论
您可以在第一个项目中开发和测试捆绑软件,并在第二个项目中将其与github和composer结合使用。



