psr-0

Composer does not generate autoloader information (autoload_namespaces.php)

北战南征 提交于 2019-12-12 21:11:32
问题 I have trouble getting a project correctly installed through composer. I have a own custom package (library) hosted in a non public git repo (but centralized) which is fetched by composer (dummy project containing a composer.json just for testing my package). So the structure is like that: /test/project/composer.json index.php Content of composer.json: { "name": "vendor/test", "description": "Test-description", "authors": [{ "name": "Benjamin Carl", "email": "email@testdomain.com", "homepage"

PHP: Autoloading PEAR namespaced classes within PSR-0 namespaced classes conflict

谁说胖子不能爱 提交于 2019-12-11 13:52:53
问题 For my application I am using PSR-0 namespaces. Everything works beautiful! Until I wanted to use Twig as template parser, Twig uses PEAR pseudo namespaces. Like Twig_Loader_Filesystem. The problem is that when I want to use Twig inside my name-spaced application like this: <?php namespace Tact\ViewManager; class ViewManager { public function init() { $loader = new Twig_Loader_Filesystem($this->templatepath); $this->twig = new Twig_Environment($loader); } } ?> PHP will tell my autoloader to

Workaround for doctrine generator in PSR-4 codebase

筅森魡賤 提交于 2019-12-09 19:10:04
问题 With Symfony 2 & Doctrine on a Windows machine I'm trying to generate entities from an existing schema: php app/console doctrine:mapping:import --force CoreBundle annotation generate getters/setters on them: php app/console doctrine:generate:entities --path=/path/to/codebase/src/MyProject/CoreBundle/Entities CoreBundle generate REST CRUD controllers on them using Voryx: php app/console voryx:generate:rest --entity="CoreBundle:User" The first steps works fine and I can find the entities in my

Autoloading non-PSR0 libraries in Symfony 2.0.x

跟風遠走 提交于 2019-12-06 05:27:29
问题 The Symfony 2.0 Autoloader expects that the libraries it can handle follow the PSR0 or PEAR standard when auto-loading files. If you have an old library which does not follow any of these two standards (in my case, class files are named like name.class.php), how would you handle auto-loading of these libraries? In Symfony 2.1 this is easy as composer supports classmaps and can load this type of libraries, but how would you do it in Symfony 2.0.x ? 回答1: Inside app/autoload.php , create an

Laravel 4 Can't find BaseController from namespaced controller

痴心易碎 提交于 2019-12-05 19:03:46
I'm trying to structure my Laravel 4 site such that (1) major application groups' components (controllers/views/etc) are coupled together and (2) Laravel's supporting code outside of in my web server's document root. The default laravel home page loads fine, but I can't get a namespaced controller to route correctly. This is the relevant file structure: / [Project Root] /laravel [full laravel install here] composer.json /app /controllers BaseController.php /dev /htdocs index.php /app /PageTypes /Home /controllers HomeController.php /views HomeView.blade.php The default laravel landing page is

Workaround for doctrine generator in PSR-4 codebase

感情迁移 提交于 2019-12-04 14:09:38
With Symfony 2 & Doctrine on a Windows machine I'm trying to generate entities from an existing schema: php app/console doctrine:mapping:import --force CoreBundle annotation generate getters/setters on them: php app/console doctrine:generate:entities --path=/path/to/codebase/src/MyProject/CoreBundle/Entities CoreBundle generate REST CRUD controllers on them using Voryx : php app/console voryx:generate:rest --entity="CoreBundle:User" The first steps works fine and I can find the entities in my CoreBundle/Entity folder with the correct namespace: MyVendor\MyProject\CoreBundle\Entity Good so far.

Composer Not Generating Autoloads For Library

我的梦境 提交于 2019-12-04 00:16:19
问题 I've set up two projects, an 'init' and a library, which is required by the init. They both have PSR-0 autoloads set, but the autoload values from the library are not added to the vendor/composer/autoload_namespaces.php in the init project. Sample composer.json from the Library: { "name": "lxp/library", "description": "A test library", "autoload": { "psr-0": { "LXP\\Library": "src/" } } } Sample composer.json from the project that requires that library: { "name": "lxp/init", "name": "A test

How to use a PHP library with namespacing without Composer as dependency (PSR-0)?

荒凉一梦 提交于 2019-12-03 11:55:24
问题 I need to use some PHP libraries with dependencies but I have some restrictions on the webserver of the client. It is a managed webserver and I can not use a console eg over SSH. So how do I use now these libraries without Composer? Can I create some directories manually and what directories or paths do I need to create? Also, what do I need to create so autoloading and namespacing is working? Can I create the autoload.php somehow manually and what is the content of the file? 回答1: It is

How to use a PHP library with namespacing without Composer as dependency (PSR-0)?

戏子无情 提交于 2019-12-03 03:14:00
I need to use some PHP libraries with dependencies but I have some restrictions on the webserver of the client. It is a managed webserver and I can not use a console eg over SSH. So how do I use now these libraries without Composer? Can I create some directories manually and what directories or paths do I need to create? Also, what do I need to create so autoloading and namespacing is working? Can I create the autoload.php somehow manually and what is the content of the file? It is possible with a simple autoloader and it is not so hard to do it: function __autoload($className) { $className =

Composer Not Generating Autoloads For Library

我怕爱的太早我们不能终老 提交于 2019-12-01 03:06:17
I've set up two projects, an 'init' and a library, which is required by the init. They both have PSR-0 autoloads set, but the autoload values from the library are not added to the vendor/composer/autoload_namespaces.php in the init project. Sample composer.json from the Library: { "name": "lxp/library", "description": "A test library", "autoload": { "psr-0": { "LXP\\Library": "src/" } } } Sample composer.json from the project that requires that library: { "name": "lxp/init", "name": "A test init", "autoload": { "psr-0": { "LXP\\Init": "src/" } }, "repositories": [ { "type": "composer", "url":