jbowens / jBBCode

A lightweight but extensible BBCode parser
http://jbbcode.com
MIT License
164 stars 32 forks source link

Problem with Composer/PHP Autoload Path and psr-0 #12

Closed SaintPeter closed 10 years ago

SaintPeter commented 10 years ago

There is a problem with the way that composer generates the autoload path for this class that causes the class to not be found.

Steps to reproduce: 1) Create a new/blank folder 2) Install jbbcode/jbbcode from pagagist via composer- php composer.phar require jbbcode/jbbcode 3) Create a simple index.php

    include 'vendor/autoload.php';
    $parser = new JBBCode\Parser.php;

4) Load the file, see the error: Fatal error: Class 'JBBCode\Parser' not found in /home/user/html/test/index.php on line 4

I played around with it a bit and I was able to fix it by creating a subfolder to the install folder called JBBCode and moving all of the files except composer.json there. IE:

vendor/
    jbbcode/
         jbbcode/
              composer.json
              JBBCode/
                    Parser.php
                    ...

I can't figure out why this is, since psr-0 seems to suggest that the files should go in the vendor/jbbcode/jbbcode folder. Any way you slice it, though, something is funky.

jbowens commented 10 years ago

I was able to replicate this on my machine. I'll look for a fix when I get home from work.

SaintPeter commented 10 years ago

Any luck tracking this down?

jbowens commented 10 years ago

The Packagist package was created with the incorrect case. Ideally, I'd change the Packagist package, but I don't have direct control over it and it'd likely break for users currently using the package. Instead, I moved all source files into a directory of the same name as the namespace.

This should be fixed by ffd9ab7a2.