我想爲新項目使用symfony2.1。我嘗試用作曲者安裝symfony2。 但有多個錯誤/問題,所以我也有問題的每個問題在加粗字體樣式。 有時我不知道我是否以正確的方式去做。symfony2.1捆綁版本混淆,對於symfony和奏鳴曲admin/knp菜單捆綁
我想使用一個穩定的版本,所以我選擇了2.1.0版本而不是dev/master。
php composer.phar create-project symfony/framework-standard-edition symfony v2.1.0
的結果是這樣的:
Installing symfony/framework-standard-edition (v2.1.0)
- Installing symfony/framework-standard-edition (v2.1.0)
Downloading: 100%
Created project in symfony
Loading composer repositories with package information
Installing dependencies from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for symfony/symfony == 2.1.9999999.9999999-dev -> satisfiable by symfony/symfony 2.1.x-dev.
- Can only install one of: symfony/symfony dev-master, symfony/symfony 2.1.x-dev.
- Installation request for symfony/symfony == 9999999-dev -> satisfiable by symfony/sym fony dev-master.
所以我做了php composer.phar update
並沒有錯誤安裝的依賴關係。
但我注意到,大多數軟件包都沒有穩定的版本。例如學說/通用(2.3.x版本-DEV),這裏是完整列表
Loading composer repositories with package information
Updating dependencies
- Installing doctrine/common (2.3.x-dev 605b1b8)
Cloning 605b1b8b5a7bc8daf9111fb35483e5708e30de35
- Installing doctrine/dbal (2.3.x-dev 239630b)
Cloning 239630b61f03f39d198441eced1bfffb7b0e61d1
- Installing twig/twig (dev-master 68b8c46)
Cloning 68b8c4619c5bbe82bd345fe56070dec8c356610a
- Installing symfony/symfony (2.1.x-dev e7059b4)
Cloning e7059b44c78ca8e1e892adb4d93b5a482f4eb9b3
- Installing swiftmailer/swiftmailer (dev-master e12e4ef)
Cloning e12e4ef3a9d6dd60fb734a01984a6e6627aea764
- Installing doctrine/orm (2.3.x-dev 4d9f24b)
Cloning 4d9f24b2eef3af3a3e76c773994c19bbb0706f88
- Installing doctrine/doctrine-bundle (dev-master v1.0.0)
Cloning v1.0.0
- Installing twig/extensions (dev-master f904575)
Cloning f904575642b1213db69b4a98f08397e722ba1cae
- Installing kriswallsmith/assetic (dev-master dfbb776)
Cloning dfbb776288baf9319d1693195af2cb6e00729901
- Installing symfony/assetic-bundle (dev-master 4e7e8a0)
Cloning 4e7e8a039fa19434f04558473adbb201118af942
- Installing symfony/swiftmailer-bundle (dev-master d2eae93)
Cloning d2eae9385c029cbac031a90e6d2abc74b889a562
- Installing monolog/monolog (dev-master a929570)
Cloning a929570bb7688b39fefe4106f0ecf0ac35f37647
- Installing symfony/monolog-bundle (dev-master v2.1.0-RC2)
Cloning v2.1.0-RC2
- Installing sensio/distribution-bundle (dev-master 9892129)
Cloning 98921298951598e8707258cba2b6180b96faa91c
- Installing sensio/framework-extra-bundle (dev-master v2.1.0)
Cloning v2.1.0
- Installing sensio/generator-bundle (dev-master v2.1.0-RC2)
Cloning v2.1.0-RC2
- Installing jms/metadata (1.1.1)
Downloading: 100%
- Installing jms/cg (1.0.0)
Downloading: 100%
- Installing jms/aop-bundle (1.0.0)
Downloading: 100%
- Installing jms/di-extra-bundle (1.1.x-dev af21952)
Cloning af219527024c584d7311aa855d7522429c5bdb67
- Installing jms/security-extra-bundle (1.2.x-dev 9ab6ace)
Cloning 9ab6aceda50fc7a2b07d741ba4b3f0695508afcb
1A)這是正確的?還是有另一種解決方案?我的意思是使用穩定且不在開發模式下的軟件包
第二天我再次做了作曲家更新,並注意到有些庫已經更新:dev-master分支的所有庫在最後一天內發生了新的更改。
1b)因此,我應該在開發我的應用程序,合併新的錯誤修正等時定期更新作曲家?
$ php composer.phar update
Loading composer repositories with package information
Updating dependencies
- Updating swiftmailer/swiftmailer dev-master (e12e4e => c97353)
Checking out c97353b1ebffe25a224146f69d17efe24c093def
- Updating monolog/monolog dev-master (a92957 => e5bf7b)
Checking out e5bf7ba5d1df622b68d004b3c0277bc94286e1b7
- Updating friendsofsymfony/user-bundle dev-master (24edb2 => 878b7c)
Checking out 878b7c8320159fb09e8e94d446c498b00142b206
- Updating sonata-project/notification-bundle dev-master (5e7b50 => 9cef7d)
Checking out 9cef7d224f224b4e4327f200f9bd57b798d4ab0a
- Updating knplabs/gaufrette dev-master (861110 => 5ac439)
Checking out 5ac439cd46eb461043e6bb73dae717528f674a57
- Updating sonata-project/media-bundle dev-master (d04a61 => 233511)
Checking out 2335114dab6ea9680d174df157f5a7b4551a54dc
因爲我沒有發現另一種解決辦法我繼續加入這一行"friendsofsymfony/user-bundle": "*"
到composer.json安裝FOS UserBundle。 我做整個安裝的東西,它完美的作品。
然後我開始通過將"sonata-project/admin-bundle": "dev-master"
添加到composer.json來安裝Sonata AdminBundle。我選擇了dev-master版本,因爲在http://packagist.org/packages/sonata-project/admin-bundle上我發現版本2.0.x-dev不適用於symfony2.1。
此外,AdminBundle有knplabs/KNP-菜單束一depdency:1.1 *
在http://packagist.org/packages/knplabs/knp-menu-bundle我看到的版本V1.1.0,有對knplabs/KNP-菜單中選擇另一個依賴:1.1 *
然後在http://packagist.org/packages/knplabs/knp-menu我發現4個版本與1.1開始的:
- 1.1.x版本-dev的
- V1.1.2
- V1.1.1
- V1.1.0
2a)如果在版本號之前有一個前導v
,是否有區別?
2b)當依賴性爲1.1 *時,將使用這四個版本的哪個版本?
當我開始加載管理員束DEPS我看到的結果是:
$ php composer.phar update
Loading composer repositories with package information
Updating dependencies
- Installing knplabs/knp-menu (1.1.x-dev v1.1.2)
Cloning v1.1.2
- Installing knplabs/knp-menu-bundle (v1.1.0)
Downloading: 100%
- Installing sonata-project/admin-bundle (dev-master 20d5e4a)
Cloning 20d5e4a659bddb5fc0bcfc4755643dbc4e3f7ec1
我安裝一些更奏鳴曲束(教義-ORM管理員束,用戶捆綁,頁面捆綁,媒體-bundle),並有一個錯誤
- Installing imagine/imagine (v0.3.0)
Downloading: 100%
[ErrorException]
rename(C:\wamp\www\symfony\vendor/imagine/Imagine/avalanche123-Imagine-a23b4f5,afcc946468d0cf073686fe7e1ae19eb2): access denied
(code: 5)
3),但是當我重複步驟不見了錯誤。這是正常的嗎?
$ php composer.phar update
Loading composer repositories with package information
Updating dependencies
- Installing imagine/imagine (v0.3.0)
Downloading: 100%
- Installing knplabs/gaufrette (dev-master 8611109)
Cloning 8611109aeb0bd43fd88485c20fec7fc85b021b84
- Installing sonata-project/media-bundle (dev-master d04a617)
Cloning d04a617d81383a6e1ba65ee99c2ea4379e7daf4e
然後我繼續配置奏鳴曲管理包。添加一個創建Post實體和PostAdmin併爲其配置服務(順便說一句:服務配置有點差)後,注意到我忘記安裝Knp Menu(錯誤是:non-existent service "knp_menu.factory
)
我繼續https://github.com/KnpLabs/KnpMenuBundle/blob/master/Resources/doc/index.md並查看說明細節進行安裝。但那裏已經過時了。自smyfony2.1。 autoload.php中的$loader
不再具有registerNamespaces
函數,因爲它不是UniversalClassLoader類,它是作曲類加載器。所以我必須創建一個自己的UniversalClassLoader實例。和路徑完全不同,現在有一個父目錄knplabs
,子目錄也發生了變化。
use Symfony\Component\ClassLoader\UniversalClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;
$loader = require __DIR__.'/../vendor/autoload.php';
// intl
if (!function_exists('intl_get_error_code')) {
require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
$loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
}
$universalLoader = new UniversalClassLoader();
$universalLoader->registerNamespaces(array(
'Knp\Menu' => __DIR__.'../vendor/knplabs/knp-menu/src',
'Knp\Bundle' => __DIR__.'/../vendor/knplabs/knp-menu-bundle'
));
$universalLoader->register();
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader;
4)爲什麼KnpMenu安裝施工已經過時,爲什麼只有在GitHub上並沒有什麼針對它存在於http://packagist.org版本主分支?
我是symfony2和作曲家的新手,有時候很難理解這些東西。
同樣發生在我身上。我想整合elasticabundle,但文檔已過時。這是爲了symfony2.0,即使我看到他們有頻繁的提交,但沒有人更新安裝指南。如果安裝過時,人們如何使用它? –