psr-4

Composer psr-4 autoload issue

ε祈祈猫儿з 提交于 2021-02-07 08:26:40
问题 I have problem with autoloading with composer when i use psr-4 autoloading it doesn't work and give me error. I tried: $ composer dump-autoload and a lot of other thing but it doesn't work without require one; error: You are now a master builder, that knows how to autoload with a classmap! Fatal error: Uncaught Error: Class 'VegithemesLibraryGreeting' not found in /home/vaclav/Server/vssk/VSSK/project/aldemo/index.php:10 Stack trace: #0 {main} thrown in /home/vaclav/Server/vssk/VSSK/project

Composer psr-4 autoload issue

倾然丶 夕夏残阳落幕 提交于 2021-02-07 08:25:25
问题 I have problem with autoloading with composer when i use psr-4 autoloading it doesn't work and give me error. I tried: $ composer dump-autoload and a lot of other thing but it doesn't work without require one; error: You are now a master builder, that knows how to autoload with a classmap! Fatal error: Uncaught Error: Class 'VegithemesLibraryGreeting' not found in /home/vaclav/Server/vssk/VSSK/project/aldemo/index.php:10 Stack trace: #0 {main} thrown in /home/vaclav/Server/vssk/VSSK/project

How to create a PSR-4 autoloader for my project?

假如想象 提交于 2021-01-28 03:06:17
问题 I am creating a PHP project and want to implement PSR-4 autoloading. I don't know which files I need to create in the vendor directory to implement autoloading for class files. 回答1: If you are using composer , you do not create the autoloader but let composer do its job and create it for you. The only thing you need to do is create the appropriate configuration on composer.json and execute composer dump-autoload . E.g.: { "autoload": { "psr-4": {"App\\": "src/"} } } By doing the above, if you

How do I call Validator from a namespace with an already existing Validator class

≡放荡痞女 提交于 2020-02-06 05:31:46
问题 I'm trying to test a function in phpspec which calls Laravel's Validator::make function (http://laravel.com/docs/4.2/validation) However, I'm trying to call that same function from a namespace where the Validator class name is already taken. How can I call that function described in the docs? Failed solutions: Attempt 1 return \Illuminate\Validation\Validator::make($values,$rules); gives me Call to undefined method Illuminate\Validation\Validator::make() Attempt 2 return \Illuminate

How do I call Validator from a namespace with an already existing Validator class

自古美人都是妖i 提交于 2020-02-06 05:31:07
问题 I'm trying to test a function in phpspec which calls Laravel's Validator::make function (http://laravel.com/docs/4.2/validation) However, I'm trying to call that same function from a namespace where the Validator class name is already taken. How can I call that function described in the docs? Failed solutions: Attempt 1 return \Illuminate\Validation\Validator::make($values,$rules); gives me Call to undefined method Illuminate\Validation\Validator::make() Attempt 2 return \Illuminate

How do I call Validator from a namespace with an already existing Validator class

北慕城南 提交于 2020-02-06 05:31:05
问题 I'm trying to test a function in phpspec which calls Laravel's Validator::make function (http://laravel.com/docs/4.2/validation) However, I'm trying to call that same function from a namespace where the Validator class name is already taken. How can I call that function described in the docs? Failed solutions: Attempt 1 return \Illuminate\Validation\Validator::make($values,$rules); gives me Call to undefined method Illuminate\Validation\Validator::make() Attempt 2 return \Illuminate

PHP composer autoload not loading class

浪子不回头ぞ 提交于 2020-01-24 08:41:26
问题 I'm just getting started using composer for dependency management and I'm having a hard time figuring out how I'm not adhering to psr-4 for autoloading so I'm here for advice. I've got a class that generates random values that is already on the packagist. The project structure is the following (I've labeled the composer.json files A and B): project dir |classfile.php A |composer.json |vendor |autoload.php |ejfrancis |php-random-value B |composer.json |RandomValue.php <--the class I want

Why using PSR4 autoload doesn't add any classes into classmap/namespaces file?

早过忘川 提交于 2020-01-14 03:16:28
问题 I've got the following composer.json file: { "require-dev": { "queueit/KnownUser.V3.PHP": "dev-master" }, "repositories": [ { "type": "package", "package": { "name": "queueit/KnownUser.V3.PHP", "version": "dev-master", "source": { "type": "git", "url": "https://github.com/kenorb-contrib/KnownUser.V3.PHP.git", "reference": "task/composer-autoloader" } } } ] } However upon running composer install , the namespaces or classes aren't added into autoload_classmap.php or autoload_namespaces.php in

Is it possible use multiple classes under the same namespace, in the same file

痞子三分冷 提交于 2020-01-10 01:02:28
问题 Is it possible use multiple classes under the same namespace, in the same file? I want to do something like this: <?php namespace MyNamespace\Helpers\Exceptions use Exception; class CustomException1 extends Exception{} class CustomException2 extends Exception{} class CustomException3 extends Exception{} to avoid using one single file for each custom exception class. The problem is, when I try to use, in another class, one of the custom exceptions, use MyNamespace\Helpers\Exceptions

How to generate Doctrine entities From Database and Use PSR-4 Autoloading?

家住魔仙堡 提交于 2020-01-04 05:43:25
问题 Using Doctrine 2.5 with PSR-4 autoloading and converting an already designed database schema to entity classes (annotations). The problem is getting the exported files in the correct directory structure. composer.json { "autoload": { "psr-4": { "Application\\": "src/" } }, "require": { "doctrine/orm": "^2.5" } } orm:convert-mapping vendor/bin/doctrine orm:convert-mapping \ --namespace='Application\Entity\' \ --force \ --from-database \ annotation \ src/ Running this command will add an