2016-10-13 19 views
0

私はSymfony 3.1を使ってWebアプリケーションを開発しようとしており、FakerGuzzleのような外部ライブラリを使う必要があります。しかし、毎回私はこのような作曲家でそれらをインストールしよう:3rd partyライブラリを作曲者経由でSymfony 3.1にインストールするには?

composer require fzaninotto/Faker 

それは、常にこのようなエラーがスローされます。

Using version ^1.6 for fzaninotto/Faker 
./composer.json has been updated 
Loading composer repositories with package information 
Updating dependencies (including require-dev) 
    - Installing fzaninotto/faker (v1.6.0) 
    Loading from cache 

Writing lock file 
Generating autoload files 
> Incenteev\ParameterHandler\ScriptHandler::buildParameters 
Updating the "app/config/parameters.yml" file 
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap 
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache 


    [Symfony\Component\Config\Exception\FileLoaderLoadException] 
    There is no extension able to load the configuration for "service" (in C:\xampp\htdocs\myapp\app/config\config.yml). Looked for namespace "service", found "framework", "securi 
    ty", "twig", "monolog", "swiftmailer", "doctrine", "doctrine_migrations", "sensio_framework_extra", "debug", "web_profiler", "sensio_distribution" in C:\xampp\htdocs\myapp\app 
    /config\config.yml (which is being imported from "C:\xampp\htdocs\myapp\app/config/config_dev.yml"). 



    [Symfony\Component\DependencyInjection\Exception\InvalidArgumentException] 
    There is no extension able to load the configuration for "service" (in C:\xampp\htdocs\myapp\app/config\config.yml). Looked for namespace "service", found "framework", "securi 
    ty", "twig", "monolog", "swiftmailer", "doctrine", "doctrine_migrations", "sensio_framework_extra", "debug", "web_profiler", "sensio_distribution" 


Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception 

Installation failed, reverting ./composer.json to its original content. 


    [RuntimeException] 
    An error occurred when executing the ""cache:clear --no-warmup"" command: 


    [Symfony\Component\Config\Exception\FileLoaderLoadException] 

    There is no extension able to load the configuration for "service" (in C:\xampp\htdocs\myapp\app/config\config.yml). Looked for namespace "service", found "framework 
    ", "securi 
    ty", "twig", "monolog", "swiftmailer", "doctrine", "doctrine_migrations", "sensio_framework_extra", "debug", "web_profiler", "sensio_distribution" in C:\xampp\htdocs\res 
    epkita\app 
    /config\config.yml (which is being imported from "C:\xampp\htdocs\myapp\app/config/config_dev.yml"). 





    [Symfony\Component\DependencyInjection\Exception\InvalidArgumentException] 

    There is no extension able to load the configuration for "service" (in C:\xampp\htdocs\myapp\app/config\config.yml). Looked for namespace "service", found "framework 
    ", "securi 
    ty", "twig", "monolog", "swiftmailer", "doctrine", "doctrine_migrations", "sensio_framework_extra", "debug", "web_profiler", "sensio_distribution" 



    . 


require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packages>]... 

私は本当にこのまたは方法については、サードパーティのsymfonyのバンドルを使用する必要がありますかライブラリを「そのまま」使用できますか?この

// composer.json 
{ 
    // ... 

    "autoload": { 
     "psr-4": { 
      "Custom\\Namespace\\": "relative/path/to/library" 
     } 
    } 
} 

よう

答えて

2

config_dev.ymlの中に「サービス」ブロックを置いているようです。つまり、バンドルがインストールされておらず、その設定に関連付けられていないということです。

ちょうどその「サービス」ブロックを削除し、あなたはsymfonyのクリーンインストールと魔法のように動作して

composer require fzaninotto/Faker 

作品ので、問題ないはずです。

+0

ありがとう!それは今働く。 – Furunomoe

-1

あなたができる自動ロード作曲とサードパーティのライブラリをパスがルートをパッケージ化する相対的でなければなりません。

さらに詳しい情報は、作者documentationで見つけることができます。

1

config.ymlファイルに入力するだけで、services:の代わりにservice:と書きました。

+0

わかりました。ありがとう! – Furunomoe

関連する問題