Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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



29.9k

Hi,

try with:

use \Phalcon\Utils\Slug;



958

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



1.1k
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?



958

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