Note that there are some explanatory texts on larger screens.

plurals
  1. POComposer is not loading my own psr-0 files
    primarykey
    data
    text
    <p>I can't seem to get composer to work with my own classes/files using the psr-0 autoload mechanism. Can anyone please shed some light as to why the below isn't working?</p> <p>I'm getting the following output in my error log:</p> <blockquote> <p>PHP Fatal error: Class 'TestdirTest1' not found in /home/webroot/bitlama/index.php on line 5</p> </blockquote> <p>It does work If I uncomment the explicit require statement (index.php:2).</p> <p>And if anybody is wondering - yes I have run composer install in the form of: 'php ../composer.phar install'. </p> <p>This is my directory structure:</p> <pre><code>├── composer.json ├── index.php ├── testspacedir │   └── Testdir │   └── test1.php └── vendor ├── autoload.php └── composer ├── autoload_classmap.php ├── autoload_namespaces.php ├── autoload_real.php └── ClassLoader.php </code></pre> <p>composer.json:</p> <pre><code>{ "autoload": { "psr-0": { "Testdir\\": "testspacedir/"} } } </code></pre> <p>test1.php:</p> <pre><code>&lt;?php namespace Testdir; class Test1 { public function __construct() { echo "Woohoo Test1"; } } </code></pre> <p>index.php:</p> <pre><code>&lt;?php require 'vendor/autoload.php'; //require 'testspacedir/Testdir/test1.php'; $test1 = new Testdir\Test1(); </code></pre> <p>vendor/autoload.php:</p> <pre><code>&lt;?php // autoload.php @generated by Composer require_once __DIR__ . '/composer' . '/autoload_real.php'; return ComposerAutoloaderInit7b4760e0f7ca9d6454dd2f098c374ba4::getLoader(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload