FOSUserBundle not found in appkernel

I am using symfony on Windows and I tried to configure FOSUserBundle as described in the official documentation.

I get this error when try to update the schema:

Class 'FOS\UserBundle\FOSUserBundle' not found in app/AppKernel.php line 20;

searched for the problem and find this solution: adding this to autoload.php

$loader->registerNamespaces(array(
    //all the rest
    'FOS' => $vendor_dir . '/bundles',
));

but it returns another error which says

call to undefined method ...\ClassLoader::RegisterNamespace() in ...\autoload.php on line 13

can anybody plz tell me what should i do?:|

and this is my appkernel.php file:

<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new Sad\Bundle\WarehouseBundle\SadWarehouseBundle(),
            new FOS\UserBundle\FOSUserBundle(),
        );

       if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
    }
}

I had the same problem. I found out that the FOSUserBundle was not properly installed. You should delete your /vendor/friendsofsymfony/ directory and then update the bundle using:

php composer.phar update friendsofsymfony/user-bundle

It worked for me. I hope it helps someone else having the same issue.

symfony - FOSUserBundle not found in appkernel, I had the same problem. I found out that the FOSUserBundle was not properly installed. You should delete your /vendor/friendsofsymfony/ directory and then  Class 'FOS\UserBundle\FOSUserBundle not found in C:\wamp\www\Symfony\app\Appkernel.php on line 22. Alors que toute les configurations sont bonne et marchaient bien depuis un bout de temps et je n'ai rien depuis l'installation. je poste les codes pour voir des erreurs: Appkernel.php

Class 'FOS\UserBundle\FOSUserBundle' not found · Issue #554 , "Fatal error: Class 'FOS\UserBundle\FOSUserBundle' not found in /home/my/​www/sf.com/app/AppKernel.php on line 13". My Bundle located here  In any case, this does not look like a FOSUserBundle issue at all, but as a Composer usage issue. I'm closing this issue then. XWB closed this Sep 15, 2015

To fix this error in Symfony 3.x.

If composer can not be executed and you can only transfer the files by FTP, it's necessary to update the file:

vendor/composer

and maybe

vendor/symfony (if the version is updated)

The same solution applies to this error

Fatal error: Class 'FOS \ JsRoutingBundle \ FOSJsRoutingBundle' not found

Fatal error: Class 'FOS\UserBundle\FOSUserBundle' not found , "Fatal error: Class 'FOS\UserBundle\FOSUserBundle' not found in C:\wamp\www\​symfony\app\AppKernel.php on line 23" This is my file path: Afaik the Resources directory of your bundle is not a location Doctrine will treat as a default location for entities when auto_mapping is enabled. Put it in Application\MainBundle\Entity\User instead. Copy link Quote reply Tharindu-Diluksha commented Jan 20, 2016

FOSUserBundle not found in appkernel, Class 'FOS\UserBundle\FOSUserBundle' not found in app/AppKernel.php line 20​;. searched for the problem and find this solution: adding this to autoload.php. I'm a newbie of symfony2 and FOSuserbundle, but i found it's quite interesting to learn them step by step, However, I got a problem, I created the user, but I just couldn't login! It seemed that the system just can't recognize the password, I searched the web, but I didnt find anyone had the same problem with me.

[Résolu] [Symfony2] FOSUserBundle not found par Zero19 , Class 'FOS\UserBundle\FOSUserBundle not found in C:\wamp\www\Symfony\​app\Appkernel.php on line 22. Alors que toute les configurations  It's weird because - if the bundle is not installed in composer or in AppKernel, then you won't even be able to get to /register at all. The fact that you could get there but it failed on submit that's the strange part ;).

Class 'FOS\UserBundle\FOSUserBundle' not found in app , Class 'FOS\UserBundle\FOSUserBundle' not found in app/AppKernel.php line 20​. It's the only bundle with the "dev-master" tag (~2.0@dev). Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. class included in AppKernel can not be found. Ask

Comments
  • What symfony version are you using? It has been a long time since we had to register the namespaces manually. Have you downloaded the vendor script using composer?
  • i'm using the latest version which is 2.3 and also using composer to dl and install the bundles.
  • Is there a a {YOUR_PROJECT_PATH}\vendor\friendsofsymfony\user-bundle\FOS\UserBundle folder?
  • yes,It's there and it contains the FOSUserBundle.php file
  • I'm having a hard time figuring out what's happening. Can you edit your question and add the content of your AppKernel.php?
  • tnx for your time... but it doesn't change:( I had another project which works well without this problem...i'm going to modify it...