Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6227677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:15:48+00:00 2026-05-24T09:15:48+00:00

After 4 years of absence in PHP programming I’m trying to make some new

  • 0

After 4 years of absence in PHP programming I’m trying to make some new project in it.

I’m collecting some useful libraries. And I have problem with “use” keyword. Here is my part of code where error is thrown.

<?PHP

    use Assetic\Asset\AssetCollection;
    use Assetic\Asset\FileAsset;
    use Assetic\Asset\GlobAsset;

    $js = new AssetCollection(array(
    ...
?>

And I’m getting error:

Fatal error: Class 'Assetic\Asset\AssetCollection' not found in /home/php/index.php on line 7

I thought that is maybe something wrong with include_path in php.ini, but it looks like that:

include_path = ".:/usr/share/php5:/usr/share/php"

Did I miss something?

BTW. I’m using nginx + php-fpm.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T09:15:49+00:00Added an answer on May 24, 2026 at 9:15 am

    The use keyword does not actually include any files. I’m afraid you either have to register an autoload function with the spl_register_autoload() call, or manually include the files.

    http://www.php.net/manual/en/function.spl-autoload-register.php

    Usually a good default autoloader will look for files following the same path as the namespaces, like this:

    spl_autoload_register(
        function($className)
        {
            $className = str_replace("_", "\\", $className);
            $className = ltrim($className, '\\');
            $fileName = '';
            $namespace = '';
            if ($lastNsPos = strripos($className, '\\'))
            {
                $namespace = substr($className, 0, $lastNsPos);
                $className = substr($className, $lastNsPos + 1);
                $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
            }
            $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
    
            require $fileName;
        }
    );
    

    More on autloading in PHP, a structure that many (newer) projects are following: http://groups.google.com/group/php-standards/web/psr-0-final-proposal

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After years in embedded programming, I have to develop a Windows app. I dug
After years of programming, we all have a set of small functions used as
After years of programming, I havent had a situation where reasonable malloc or new
Just dipping my toes into Linq2sql project after years of rolling my own SQL
I am about to reenter the MFC world after years away for a new
After some years of experience in the field, it seems to me that the
After two years of C#, my VB.NET is a bit rusty. I have two
I am finally experimenting and trying to learn MVC after years of asp.net. I
After five years of professional Java (and to a lesser extent, Python) programming and
I'm trying IntelliJ IDEA after many years as an Eclipse user. At the same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.