Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
775 views

Cannot autoload class using composer from within other autoloaded class file

I'm new to using composer for autoloading custom class files using 'PSR-0' way of autoloading classes. Below is my directory tree structure. And below is my PSR-0 config in the composer.json file ...
Danish Nayeem's user avatar
1 vote
0 answers
85 views

PSR: should I add basic classes to the namespace section?

Some people add basic classes like Exception, Throwable, DateTime etc to the namespace section like this: <?php namespace Foo\Bar; use DateTime; use Throwable; Class MyClass{ public ...
Hevyweb's user avatar
  • 440
0 votes
0 answers
106 views

Mine Composer Autoload PSR-4 is not working

I have a problem with my composer and I don't know where to run. I took several classes on how to do this, but my composer doesn't work well. It manages to import my database connection class, but the ...
Vinícius's user avatar
0 votes
0 answers
46 views

Mark as PSR compliant at file level

I'm working in a codebase that is not fully PSR compliant at this point. Auto format can not be enabled as that would lead to a massive amount changes in pull requests. We're now working through the ...
Martijn's user avatar
  • 16.1k
-1 votes
2 answers
999 views

PSR-0 autoloader issue

I have trouble instantiating class by path in my PSR-0 autoloaded project. Structure is as follows: | - src/ | - Models/ | - My_New_Model_Migration.php | - ... | SeederCommand.php ...
Norgul's user avatar
  • 4,783
1 vote
1 answer
602 views

How to change PSR log files as only one per day

I've used PSR logger to get logs. But it will create just one file for all dates. I need to get separate log files to each date. How to do that? require_once '../../logger/vendor/autoload.php'; ...
Prasad D. Warnakulasuriya's user avatar
0 votes
1 answer
147 views

How to add a new non-git private package/classes to a PHP application?

I have a small package with 6-7 files (i.e., main class, extending classes, interface, which can be viewed in this link) and I'd like not to use require_once method to connect these classes together. ...
Emma's user avatar
  • 27.7k
0 votes
1 answer
382 views

Composer not autoloading classes in directory with same name

I am using composer to include a private package in my project that will includes some classes I will use to test against with PHPUnit. Most of the package is being autoloaded correctly and I can call ...
Jon Erickson's user avatar
  • 1,946
1 vote
1 answer
2k views

Netbeans 8 complaining about SF4 namespaces

I have a bunch of classes in src/Controller, src/Entity, src/Form etc. For each of them Netbeans tells me that "namespace declaration name doesn't correspond to current directory structure". My ...
Tompo's user avatar
  • 25
0 votes
1 answer
507 views

PhpStorm using incorrect namespaces

I have an issue with my PhpStorm using incorrect namespaces when creating a new class. Example: I have a module named Booking. Inside Booking I want to create a controller called StatusController. ...
Skytiger's user avatar
  • 1,845
1 vote
2 answers
782 views

How to have "dashes" in filenames in ZendFramework 1.12

I have seen a few posts regarding this question but none were answered to the topic on which they were asked. I have a ZendFramework project (v 1.12) and I want to do some changes in the file naming ...
Ashish Ranjan's user avatar
0 votes
1 answer
1k views

Error "Class not found" using Composer PSR-0 autoloader on Eclipse Neon PDT

I am currently trying to build a new PHP project from scratch (inside a git repository), using Composer (for the very first time), on Eclipse Neon PDT with Composer Eclipse Plugin and EGit. In order ...
P. Mergey's user avatar
  • 343
0 votes
1 answer
1k views

Class not found, composer and Zend Framework 1 autoloader issue

I have the following class autoload definition in a [root]/composer.json file: { ... "autoload": { "psr-0": { "": [ "application/models", "application/controllers", ...
ReynierPM's user avatar
  • 18.6k
0 votes
2 answers
559 views

Getting Error in PHP Autoload

I am using PSR-0 for auto loading, I know that I need to use PSR-4 which I will do it latter part. Even if PSR-4, answers are welcome. I am having the following directory structure for which the auto ...
Channaveer Hakari's user avatar
0 votes
2 answers
2k views

PHP - Doctrine - How to autoload entities classes using a single namespace

I have a group of PHP files containing classes (entities). Each class has the same namespace: // src/App/Entity/Actions.php namespace App\Entity; use Doctrine\ORM\Mapping as ORM; /** * Actions * ...
Horse O'Houlihan's user avatar
0 votes
1 answer
2k views

Behat 3 + Symfony 3 Context with namespace doesn't work, when without works

I have the following catalogs structure: composer.json behat.yml src |--AppBundle |--Features |--example.feature |--Context |--FeatureContext.php And the following behat.yml ...
Daniel's user avatar
  • 8,577
1 vote
1 answer
433 views

psr-0 autoloading with composer not wotking, but it works perfectly with psr-4 autoloading

I tried to autoload a file with PSR-0 ,but it is not auto loading that file. I tried the same file with PSR-4 auto loading. With PSR-4 it worked perfectly. Is there any difference in folder structure ...
Ricky Mathew Kuruvilla's user avatar
1 vote
1 answer
1k views

PHP - Namespace not found, autoload project with composer

I'm quite new to autoloading and namespaces, and attempting to add namespaces to my MVC project. So In my composer I added: "autoload": { "psr-0": { "prj\\app\\": "app/", "prj\\...
mhvvzmak1's user avatar
  • 317
2 votes
1 answer
1k views

How do I set up Doctrine 2 with multiple Entity Managers in one Project? (without Symfony/Zend)

Current Situation I am using Doctrine 2 (without Zend and Symfony) for accessing two different MySQL databases in my Project. I tried to create two EntityManager for each database one. The two ...
h.kenny's user avatar
  • 31
0 votes
1 answer
322 views

'Alias is never used' PHPStorm error message within my PHP file

I am following the installation instructions here to install PHP RAML Parser I run composer install and created the index.php below but it isn't working, I get an error: Class 'Raml\...
Zabs's user avatar
  • 14.1k
2 votes
1 answer
683 views

Class not found with Composer autoload and PSR-0

I'm trying to use PSR-0 instead of classmap in composer but having some difficulty. It appears that my json file is correct yet the class I'm trying to access is not being picked up. Can someone ...
Martyn's user avatar
  • 6,355
5 votes
1 answer
245 views

Eclipse - Using File Name Conventions on Refactoring php-Classes

I am new to eclipse and am using version Version: Mars.1 Release (4.5.1) I am using the refactoring tool of the "PHP Development Tools 3.6" plugin to rename e.g. classes. Our class file names follow ...
Ben's user avatar
  • 51
-1 votes
2 answers
3k views

PHP PSR validator [closed]

I am looking for a tool that can check my PHP codes and automatically update into as per PSR standard or atleast point out the places where code violates PSR standards. Google search was not too ...
Kamrul Khan's user avatar
  • 3,350
0 votes
2 answers
154 views

How to autoload a repository in composer which does not follow PSR-0 or PSR-4?

So, I'm trying to use jcleblanc/reddit-php-sdk, but it follows no standards whatsoever and does not have a repository available, so I've had to manually define it myself in my composer.json file: "...
marked-down's user avatar
  • 10.3k
2 votes
1 answer
640 views

Why are underscores converted to directory separators in PSR-0?

I'm trying to figure out why would underscores in class names be converted to directory separators in PSR-0? I'm sure there is a reason for it, but I can't think of why. If I have a class named ...
d.lanza38's user avatar
  • 2,607
0 votes
0 answers
71 views

Laravel 5 Incude a non PSR-0 compliant Library via a Git Repo

I currently have a laravel 5 project I am working on. I would like to use the following library (https://github.com/jamesiarmes/php-ews) however my question pertains to any non PSR-0 compliant library....
eric MC's user avatar
  • 766
4 votes
2 answers
4k views

PSR-2. When to capitalize directories?

As I understood according to PSR-2 standard we should capitalize directory names which contain classes. But how to do if the directory also contains some other files, for example styles and scripts? ...
ymakux's user avatar
  • 3,485
3 votes
2 answers
2k views

Workaround for doctrine generator in PSR-4 codebase

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/...
phpPhil's user avatar
  • 926
0 votes
1 answer
825 views

autoloading nested classes with composer

I have created a very basic validator class. My base code is in a my src/ folder, which gets autoloader with "kevdotbadger\\Validator\\": "src/" this works fine, so that when I instantiate a new "...
dotty's user avatar
  • 41.3k
0 votes
1 answer
136 views

How do I autoload old class names in PHP Zend 2? [duplicate]

How do I autoload the class Google_Client in Zend 2?
András Gyömrey's user avatar
0 votes
1 answer
762 views

Wordpress plugin with classes, namespaces and psr-0 autoloading

I'm pretty new at this Wordpress thingy and I've now made my own theme and would like to create a plugin that handles my slideshow. (I have to teach this for some pupils later on, so I cannot just ...
Ulrik McArdle's user avatar
2 votes
1 answer
4k views

How to use Composer to load php classes from local repository?

I am new to Php and composer, I want to access a Php class to another module using composer, This is my basic project structure (two modules common and worker) index.php TestLocalRepository --/Souce ...
Aditya Kamat's user avatar
0 votes
1 answer
5k views

Class not found issue (Composer, PHPUnit)

Getting the following error form PHPUnit: Fatal error: Class 'FoobarTest\Money\Money' not found in /www/foobar/tests/FoobarTest/Money/MoneyTest.php on line 11 My structure is like: /src/Foobar/...
Daniel W.'s user avatar
  • 32.2k
4 votes
2 answers
3k views

How to organize PHPUnit tests and autoloading with NetBeans IDE

There are rules for autoloading ( http://www.php-fig.org/psr/psr-0/ ) and PHPunit testing ( https://phpunit.de/manual/current/en/organizing-tests.html ). Separetely they are easy to implement but ...
mwloda's user avatar
  • 491
1 vote
2 answers
2k views

Using PSR-0 in composer.json does not load my classes

In composer.json I have the following data: { "require": { "slim/slim": "2.*", }, "autoload": { "psr-0": { "lib": "lib/" } } } lib folder ...
Alireza's user avatar
  • 6,808
2 votes
0 answers
467 views

phpstorm move class without opening the file

Is it possible to MOVE CLASS in phpstorm without having to open the class file, select the class name et hit F6 ??? I have defined PSR0 source root, but it seems that it's note related to the problem ...
resehuvija's user avatar
0 votes
1 answer
1k views

Composer psr-0 autoloading of custom namespaces does not work

I have trouble adding my own namespaces to composer with PSR-0. I have read this and this but I still can't make it work composer.json { "require": { "klein/klein": "2.0.x", "doctrine/orm": "...
Georgi Georgiev's user avatar
1 vote
1 answer
2k views

Autoloading two vendor projects with composer at the same time

I've two projects (project1, project2) with composer set up correctly, with their own composer.json { "require": { "wp-cli/wp-cli": "0.15.1" } } Now, in another php file I autoload ...
Ryan's user avatar
  • 10.1k
3 votes
1 answer
977 views

Should I always use fully qualified class name in PHP?

I see some example code such as $log = new Monolog\Logger('name'); Why not always use the fully qualified class name instead? $log = new \Monolog\Logger('name'); So you don't need to worry if ...
Ryan's user avatar
  • 10.1k
1 vote
1 answer
1k views

Autoloading multiple PHP projects via composer

Assume I have folder layout as projectA projectA\src projectA\vendor\autoload.php projectB projectB\src projectB\vendor\autoload.php projectC projectC\src projectC\vendor\autoload.php These ...
Ryan's user avatar
  • 10.1k
0 votes
1 answer
619 views

This autoloader loads only the first class

I have the following autoloader, that for some reason is loading only the first class. Here is the Autoloader class <?php class AutoloaderException extends Exception{} class AutoLoader { ...
robue-a7119895's user avatar
269 votes
5 answers
81k views

What Are the Differences Between PSR-0 and PSR-4?

Recently I've read about namespaces and how they are beneficial. I'm currently creating a project in Laravel and trying to move from class map autoloading to namespacing. However, I can't seem to ...
Varun Nath's user avatar
  • 5,632
1 vote
1 answer
639 views

Refactoring Code To Psr standard and making the code testable in Laravel 4

When i started making a mobile app (that uses laravel on the server) i decided to not dig into testing or coding standards as i thought it was better to actually get a working app first. A few months ...
Varun Nath's user avatar
  • 5,632
0 votes
1 answer
322 views

Filename of workers in Symfony Gearman bundle

On Symfony, I use Gearman to queue some jobs with Ulabox GearmanBundle as the application-side library. I read how a worker should be created in the readme of the bundle, and understood that I should ...
TheTom's user avatar
  • 1,044
0 votes
1 answer
307 views

In Symfony2's "The Components -> The PSR-0 Class Loader" section which file(s) is being edited?

I'm trying to grasp how to include a PSR-0 enabled external library on my Symfony2 project. In "The PSR-0 Class Loader" page (here: http://symfony.com/doc/master/components/class_loader/class_loader....
Nelson Teixeira's user avatar
4 votes
1 answer
658 views

autoload psr-4 gets lost during install

this is the composer.json of my bundle (shortened) { "name": "acme/my-bundle", "type": "library", "version": "0.5.0", "autoload": { "psr-4": { "Acme\\MyBundle\\": "...
auipga's user avatar
  • 329
1 vote
1 answer
1k views

Class RemindersController does not exist

I changed the app/controllers to app/Controllers, add in composer.json file: "psr-0": { "Controllers": "app/", "Test":"app/" } In my controllers, i add: namespace Controllers; When i was ...
Lucas Silva's user avatar
  • 1,411
2 votes
2 answers
428 views

PSR-0 Implementation on Class Loading

I'm not new to PHP but I'm new to PSR. I've read some of it and I want to give a try to follow this standards on coding but I'm a bit confused how can implement it. So I need a simple advice from you ...
user3651491's user avatar
0 votes
2 answers
417 views

namespace and psr-0 not working in my laravel 4 application

i have followed this tutorial http://www.youtube.com/watch?v=yAzd7Ig1Wgg to get namepsaces with psr-0 working in my laravel 4 application but no joy. What im i missing? my folder sttructure >App &...
nsj's user avatar
  • 45
0 votes
2 answers
331 views

Issue with PSR-0 autoloading

I am trying to use this composer package with a new project I am working on https://packagist.org/packages/activecollab/activecollab-sdk. However when i try and create a new class I keep getting the ...
michael.schuett's user avatar