Search code examples
phpfuelphp

FuelPhp Framework: can't find Casset class


I got this problem when I use FuelPhp framework. And the project wasn't initially developed by me. Here is the code:

foreach (array(
        'reset.css', 
        'jquery-ui-1.8.15.custom.css',
        'imgareaselect-default.css',
        'select2.css',
        'colorpick.css',
        'master.css'
    ) as $c) { Casset::css($c); }

And the error log

ErrorException [ Error ]: Class 'Casset' not found APPPATH/classesPKGPATH/controllerPKGPATH/base.php @ line 238

Backtrace

Warning: include(\casset\bootstrap.php) [function.include]: failed to open stream: No such file or directory in COREPATH/classesPKGPATH/fuel.php @ line 403 Warning: include() [function.include]: Failed opening '\casset\bootstrap.php' for inclusion (include_path='.;C:\php\pear') in COREPATH/classesPKGPATH/fuel.php @ line 403

Thank you in advance!


Solution

  • Reading your error it seems that your application isn't able to find APPPATH and PKGPATH. They should be defined in the /public/index.php file.

    This is my configuration:

    /**
     * Website document root
     */
    define('DOCROOT', __DIR__.DIRECTORY_SEPARATOR);
    
    /**
     * Path to the application directory.
     */
    define('APPPATH', realpath(__DIR__.'/../fuel/app/').DIRECTORY_SEPARATOR);
    
    /**
     * Path to the default packages directory.
     */
    define('PKGPATH', realpath(__DIR__.'/../fuel/packages/').DIRECTORY_SEPARATOR);