Questions tagged [psr-4]

PSR-4 describes requirements that must be adhered to for autoloader interoperability in PHP. PSR-4 is an alternative to PSR-0 that corrects problems discovered in real-world use.

Specification link:

Code and test samples:

308 questions
-1
votes
1 answer

'Use' namespace doesn't do anything - PHP

So i've got the following code, but for some reason the use statement doesn't seem to do anything. class Image { use \App\Traits\File; public static function get() { $image_url = File::getVersion() } } Throws an error…
KeironLowe
  • 711
  • 1
  • 8
  • 21
-1
votes
2 answers

Composer PSR-4 autoloading completely ignored

I have composer.json file: { "name": "marko/art-empire", "description": "Social network", "type": "project", "authors": [ { "name": "Marko Ilic", "email": "markowebdeveloper@gmail.com" } …
Marko
  • 1
  • 2
-1
votes
1 answer

Symfony 2 namespace error only in production ("Attempted to load class...)

I am working on a Symfony 2 website, and having an issue only in production (cache is clear). I am using the Payplug php api : I' ve put the files in the vendor folder, I use the namespace for the classes I use, and everything is ok on my local dev…
singe batteur
  • 401
  • 2
  • 14
-1
votes
3 answers

Class 'app\Models\User' not found Laravel 5.4

The message "Class 'app\Models\User' not found" appears, but I've researched in several places and none of the solutions worked. composer.json: "autoload": { "classmap": [ "database","Models" ], "psr-4": { "App\\":…
Lucius
  • 1,246
  • 1
  • 8
  • 21
-1
votes
1 answer

Why isn't php's class loading is not as simpler as java "import"?

PHP developers who are using class features in their projects would have to do a lot of circus to load specific class before using them. php __autoload() (would be deprecated in future), spl_autoload_register(), psr-0 & psr-4 standards to autoload…
-2
votes
3 answers

PSR-4 Autoloading option is not loading classes in my project?

When I try to load my classes using psr-4 autoloading option, I get this error 'Fatal error: Uncaught Error: Class 'HomeController' not found in C:\xampp\htdocs\gacho\App\Core\Application.php:17 Stack trace: #0…
rose
  • 447
  • 5
  • 18
-2
votes
1 answer

PHP Namespace convention

i am not sure if this is possible in PHP namespaces. please help me // folder structure app -- ModelsFolder // the models folder ---- ComponentsFolder // some traits ------ Traits::class ---- User::class ---- OtherModel::class the Classes are only…
Hitori
  • 569
  • 1
  • 5
  • 21
-2
votes
1 answer

Custom Class not found weird error in Laravel 4 using PSR-4 Autoloading

In my custom class. api_function('admin_login', $data); } public function…
aldrin27
  • 3,407
  • 3
  • 29
  • 43
1 2 3
20
21