kalimatas / php-liquid

A PHP port of Ruby's Liquid Templates
http://www.delacap.com/artikel/Liquid-Templates/
MIT License
169 stars 59 forks source link

Autoloading issue: PSR-0 vs PSR-4 #178

Open live627 opened 1 year ago

live627 commented 1 year ago

Difference between psr-0 and psr-4

PSR-4 is something like 'relative path', PSR-0, 'absolute path'.

psr-0

Looking at vendor/composer/autoload_namespaces.php file you can see the namespaces and the directories that they are mapped to.

composer.json

"autoload": {
        "psr-0": {
            "Liquid\\": "src/"
        }
} 

psr-4

Looking at vendor/composer/autoload_psr4.php file you can see the namespaces and the directories that they are mapped to.

composer.json

"autoload": {
    "psr-4": {
        "Liquid\\": "src/"
    }
}   

composer.json

"autoload": {
    "psr-4": {
        "Liquid\\": "src/Liquid/"
    }
}    

How to fix

Either

sanmai commented 1 year ago

Looking for Liquid\Template in src/Liquid/Template.php

Isn't this is what we have in actuality?

live627 commented 1 year ago

So, there is no bug, really, but an issue with not following the spec exactly.