Where to put 3rd party service providers in my Silex app?

对着背影说爱祢 提交于 2020-01-07 04:02:51

问题


I've just started exploring Silex for the first time and sorry if this sounds like a stupid question.

I'd like to use a ServiceProvider written by Igorw to load YAML files. Every 3rd party Service Provider has the same structure:

- /src
-- /Igorw
--- /Silex
---- SomeServiceProvider.php

I was wondering where to put these files in my own app? What is considered best practice? I can't really find any information about that. My own app structure looks like this:

/app
/src
    /controller
    /view
    ...
/vendor
/web
composer.json

回答1:


You should just be able to install it using composer as "igorw/config-service-provider", and it will sit in the default vendor/ folder.




回答2:


3th party libraries are sometimes called vendors, put them in the vendor directory.

Moreover, install them using composer. It'll take care of where to store them and how to autoload them. Just run php composer.phar require igorw/config-service-provider:1.2.* and you are able to register and use the provider.



来源:https://stackoverflow.com/questions/17145288/where-to-put-3rd-party-service-providers-in-my-silex-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!