How To: Fix Silex & Composer Autoloading – Class Not Found Error

I started a new project in Silex this weekend and spent a while trying to figure this one out.

Fatal error: Class 'App\Model\MyAmazingClass' not found in /var/www/app/public/index.php on line 18

So, silex depends on Composer for its autoloading functionality. I normally handle my dependencies myself and build stuff from source but this is a quick project, let’s give composer a go. So, off to the composer blog to get my composer.json set up. It tells me to add the following section:

    "autoload": {
        "psr-0": {
            "App" : "src"
        }
    }

Okay, now a “composer update” to register the new dependency with composer and I can see that this line has been added to AutoLoad_Namespaces.php:

    'App' => $baseDir . '/app',

Long story short, I was expecting this line to have mapped my ‘App’ namespace to the ‘/app’ folder and expecting that a model folder under /app with my class in it would be autoloaded (crazy right?). What composer needs you to do is create your ‘App’ namespace folder under the directory that you’ve already defined for it.

Anyway, hope this helps someone else out there.

3 comments

  1. 20160926 junda
    michael kors outlet online
    cheap jordans
    cheap uggs
    christian louboutin outlet
    tiffany jewellery
    rolex watches
    true religion outlet
    michael kors outlet online
    coach outlet
    true religion jeans
    michael kors outlet
    michael kors handbags
    louis vuitton
    converse shoes
    nike outlet store
    nfl jerseys wholesale
    uggs on sale
    michael kors clearance
    new balance shoes
    ugg boots
    ugg boots
    polo ralph lauren
    burberry outlet
    uggs clearance
    nike air max uk
    cheap nike shoes
    air max 90
    ugg boots
    chaussure louboutin
    mont blanc pens
    kate spade handbags
    true religion outlet
    nike air max 90
    christian louboutin online
    nike air force 1
    uggs outlet
    air jordan shoes
    longchamp pliage
    true religion uk
    ferragamo outlet
    oakley sunglasses
    toms shoes
    nike foamposite
    celine outlet
    true religion jeans
    the north face jackets
    prada shoes
    louis vuitton
    asics
    reebok trainers
    michael kors outlet clearance
    hollister clothing
    polo ralph lauren
    lacoste polo shirts
    michael kors outlet online
    lululemon outlet
    hollister sale
    michael kors outlet
    fred perry polo shirts
    polo ralph lauren
    polo ralph lauren
    tory burch outlet
    ralph lauren shirts
    canada goose jackets
    soccer jerseys
    ralph lauren polo shirts
    michael kors bags
    replica watches
    michael kors outlet
    canada goose outlet
    swarovski crystal
    versace sunglasses
    beats by dr dre
    kobe bryant shoes
    ralph lauren polo
    moncler outlet
    marc jacobs outlet
    ugg sale
    uggs on sale
    oakley sunglasses wholesale
    mizuno running shoes
    longchamp solde
    ugg boots
    uggs outlet
    iphone case
    air jordan 4
    rolex outlet
    tiffany jewellery
    coach outlet online
    replica watches
    michael kors outlet
    ugg boots
    giuseppe zanotti outlet
    coach outlet
    polo ralph lauren
    kobe 9
    vans shoes
    chrome hearts
    true religion jeans
    swarovski crystal
    louis vuitton outlet
    tory burch outlet
    nike air max 90
    ugg outlet
    instyler ionic styler
    ugg outlet
    michael kors handbags
    abercrombie and fitch
    nike air max 90
    rolex watches for sale
    mulberry handbags
    jordan pas cher
    louis vuitton pas cher
    michael kors handbags
    nike free run
    longchamp outlet
    coach outlet
    michael kors factory outlet
    ferragamo outlet
    coach outlet
    ferragamo shoes
    oakley sunglasses
    rolex watches
    air jordan 13
    ray ban sunglasses
    michael kors outlet clearance
    prada outlet
    kobe shoes
    the north face jackets
    moncler coats
    nike trainers
    oakley sunglasses
    nike outlet store
    ray ban sunglasses
    coach outlet online
    timberland boots
    ugg australia
    michael kors wholesale
    dior sunglasses
    pandora jewelry
    longchamp handbags
    michael kors handbags
    mulberry outlet
    ed hardy clothing
    coach outlet canada
    louis vuitton
    louboutin pas cher
    lebron james shoes
    ralph lauren uk
    michael kors outlet clearance
    chrome hearts sunglasses
    louis vuitton handbags
    nike roshe run
    coach outlet
    true religion jeans
    montblanc pens
    basketball shoes
    longchamp handbags
    coach outlet
    reebok outlet store
    nike roshe run
    michael kors factory outlet
    louis vuitton outlet
    adidas trainers
    tory burch outlet
    michael kors outlet
    ugg boots
    adidas wings
    longchamp handbags
    ugg boots
    michael kors handbags
    puma outlet
    ferragamo shoes
    burberry outlet
    soccer jerseys
    toms shoes
    michael kors handbags
    hermes outlet
    ray ban sunglasses
    nike air force 1
    mbt shoes
    michael kors outlet clearance
    fitflops sale clearance
    mulberry outlet
    hollister uk
    true religion jeans
    fitflops sale
    oakley sunglasses
    michael kors outlet clearance
    nike huarache
    canada goose jackets
    ray ban sunglasses
    cheap michael kors handbags
    hermes bags
    michael kors outlet
    calvin klein underwear
    hermes belt
    louis vuitton outlet stores
    burberry outlet
    michael kors outlet online
    michael kors outlet
    hollister clothing
    canada goose jackets
    cheap mlb jerseys
    uggs outlet
    michael kors uk
    tory burch shoes
    nba jerseys
    louis vuitton outlet
    oakley sunglasses
    jordan shoes
    ugg slippers
    gucci outlet
    air max 90
    michael kors handbags
    coach outlet
    ray ban sunglasses
    adidas uk
    coach outlet online
    michael kors handbags
    true religion outlet
    longchamp pliage
    true religion sale
    nike store uk
    north face jackets
    omega watches
    ray ban sunglasses
    nike free 5
    ferragamo shoes
    louis vuitton
    adidas outlet store
    michael kors outlet store
    christian louboutin uk
    michael kors wallet
    oakley sunglasses
    louis vuitton handbags
    fitflops outlet
    mcm outlet
    abercrombie and fitch
    louis vuitton handbags
    tiffany and co jewelry
    coach outlet store
    futbol baratas
    michael kors outlet
    ralph lauren
    yeezy boost 350
    michael kors outlet online
    canada goose jackets
    ghd hair straighteners
    michael kors handbags
    louis vuitton handbags
    cheap mlb jerseys
    ray ban sunglasses sale
    salomon shoes
    oakley sunglasses
    oakley sunglasses
    oakley sunglasses
    michael kors outlet online
    mulberry handbags
    ugg boots
    cazal sunglasses
    michael kors handbags
    swarovski crystal
    coach outlet
    nike tn pas cher
    polo ralph lauren
    michael kors outlet
    coach outlet clearance
    coach handbags
    michael kors outlet
    coach outlet clearance
    fitflops sale clearance
    fitflops sale
    louis vuitton
    tiffany jewelry
    fitflops shoes
    ralph lauren uk
    ray-ban sunglasses
    michael kors outlet online
    mulberry handbags
    fitflops shoes
    louis vuitton neverfull
    jordan shoes
    ugg boots
    nike outlet
    cheap ugg boots
    bottega veneta outlet
    the north face jacket
    michael kors outlet
    cheap nfl jerseys
    ugg outlet
    cheap snapbacks
    ysl outlet
    nike blazer pas cher
    michael kors outlet
    lululemon outlet
    cheap nfl jerseys
    pandora jewelry
    ugg outlet
    beats by dre
    coach outlet
    mulberry bags
    football shirts
    christian louboutin outlet
    cartier watches
    adidas nmd runner
    air jordan 11
    ray ban sunglasses
    tiffany and co
    ugg boots
    lebron james shoes
    cheap jordans
    the north face jacket
    uggs outlet
    fitflop clearance
    north face jacket
    hollister canada
    cartier watches
    valentino outlet
    prada handbags
    coach outlet online
    cheap uggs
    tods outlet
    true religion jeans
    swarovski jewelry
    cartier watches
    michael kors outlet online
    celine outlet
    cartier outlet
    michael kors outlet clearance
    louis vuitton outlet stores
    mac cosmetics
    toms shoes
    louis vuitton outlet
    louis vuitton handbags
    louis vuitton sunglasses
    longchamp outlet
    canada goose
    ferragamo outlet
    ugg sale
    polo ralph lauren
    longchamp outlet
    cartier watches
    ray ban sunglasses
    lacoste pas cher
    hermes birkin
    michael kors factory outlet
    chicago blackhawks
    beats headphones
    hollister uk
    canada goose outlet
    lululemon outlet
    toms shoes
    cheap nba jerseys
    tory burch outlet
    louis vuitton handbags
    nike free running
    uggs outlet
    swarovski crystal
    ralph lauren polo
    thomas sabo uk
    ralph lauren pas cher
    mulberry sale
    ralph lauren pas cher
    canada goose jackets
    ralph lauren uk
    oakley sunglasses
    coach outlet
    supra shoes
    coach outlet online
    coach outlet
    swarovski crystal
    louis vuitton outlet
    canada goose outlet
    ugg boots
    true religion jeans
    tiffany outlet
    prada sunglasses
    michael kors outlet
    ugg boots
    ray ban sunglasses
    louis vuitton bags
    coach outlet clearance
    christian louboutin outlet
    michael kors outlet store
    ray ban sunglasses
    coach outlet clearance
    ugg outlet
    kate spade handbags
    nike huarache
    cheap uggs
    louis vuitton pas cher
    rolex watches
    nike mercurial
    rolex watches
    ralph lauren polo
    nike roshe
    beats by dr dre
    canada goose outlet
    ugg boots
    juicy couture outlet
    true religion jeans
    michael kors outlet online
    moncler jackets
    yeezy boost
    longchamp bag
    michael kors outlet
    adidas nmd
    ugg outlet
    nike air max 2015
    cheap nhl jerseys
    ferragamo shoes
    michael kors handbags clearance
    mulberry handbags
    longchamp pas cher
    coach outlet
    fitflops sale
    herve leger outlet
    rolex watches
    rolex watches
    links of london
    longchamp handbag
    michael kors handbags
    tory burch outlet
    michael kors handbags
    nike air max
    ugg boots
    canada goose outlet

Leave a Reply

Your email address will not be published. Required fields are marked *