Skip to content

Autoloading from relative paths does not alway work in CLI mode #1294

@LeShrimp

Description

@LeShrimp

Hey!

Thanks for your work on this awesome framework, which has served me more than well on my project.

I hat trouble using the AUTOLOAD global in CLI mode.

I have a folder structure like this

my-app/
├─ classes/
├─ public/
│  ├─ index.php
├─ config.ini

In config.ini I have

[globals]
AUTOLOAD=../classes/

The doumentation states, that The AUTOLOAD path is searched from the location of your index.php file.

This works fine for web requests.

However, for technical reasons I habe to run the CLI script from root, i.e. php my-app/public/index.php my-script. When calling the script like that the autoloading fails for some reason.

My workaround currently consists of setting the AUTOLOAD in my index.php, like this

$f3->set('AUTOLOAD', __DIR__ . '/../classes/');

This works fine, but a fix in the framework base would be highly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions