I am using Composer version 2.2.25
Per https://getcomposer.org/doc/05-repositories.md#path, I have this structure:
├── path
│ └── to
│ └── composer_stuff
│ └── compiled
│ └── composer.json
│ └── local
│ └── composer.json
│ └── src
│ └── Foo
│ └── Foo.php
│ └── public_html
│ └── index.php
/path/to/composer_stuff/compiled/composer.json
{
"repositories": [
{
"type": "path",
"url": "/path/to/composer_stuff/local",
"options": {
"symlink": true
}
}
],
"require": {
"local/local": "dev-master"
}
}
/path/to/composer_stuff/local/composer.json
{
"name": "local/local",
"type": "library",
"autoload": {
"psr-4": {
"local\\local\\": "src/"
}
}
}
/path/to/composer_stuff/local/src/Foo/Foo.php
<?php
use local\local\Foo;
class Foo {
public function __construct() {}
}
/path/to/public_html/index.php
<?php
require_once( '/path/to/composer_stuff/compiled/vendor/autoload.php' );
$foo = new local\local\Foo\Foo();
Commands:
cd /path/to/composer_stuff/compiled
composer update
vendor directory was created successfully with expected symlink.
Why does my index.php page result in this error?
Fatal error: Cannot declare class Foo because the name is already in use in /path/to/composer_stuff/local/src/Foo/Foo.php on line 4
To note: it doesn't matter if I implement something totally random like fgjhrtjhfgjghjg\fgjhrtjhfgjghjg(), same error.
I am at my wits end here =(
composer initorcomposer install? I do not see the vendor directory.php: ^5.3.2 || ^7.0 || ^8.0