We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon Incubator Classes Are Not Loading

I'm having issue with loading incubator files into my project.

I downloaded files from GitHub's website (the download zip button).

I'm using Phalcon\Loader to register the namespace for Phalcon as it's stated in the README.md I can clearly see registered namespace via spl_autoload_functions() ["Phalcon"]=>"/var/www/html/project/apps/vendor/phalcon/incubator/"

And full path of the class file is /var/www/html/project/apps/vendor/phalcon/incubator/Utils/Slug.php

Unfortunately I keep getting class not found error when I try to use incubator classes;

namespace AppName\Models

use Phalcon\Utils\Slug;

class MyModel 
{
    public function myMethod()
    {
        $slug = Slug::generate("testing slug");
        var_dump($slug);
    }
}

I get class not found error; PHP Fatal error: Class Phalcon\\Utils\\Slug not found

Why the registered namespaces are not working? I'm using Phalcon 2.0.0



43.9k

Hi,

try with:

use \Phalcon\Utils\Slug;



2.3k

Thank you for your reply @le51 Unfortunately that also doesn't work. I've tried it before just to be sure.



1.6k
Accepted
answer

While Googling for your question (saw it first in SOF), I ended up in Incubator and Phalcon Forums. Let me answer here as well, I don't know which one you are going to see first though.

Can you make sure file and folder permissions are allowing you to access incubator files? If not, can you try to change permissions accordingly and try it again?



2.3k

Thanks, I didn't think of that. I just copied and pasted the files.