Add a PSR-4 compatible load for non-composer users and update docs#431
Add a PSR-4 compatible load for non-composer users and update docs#431scottchiefbaker wants to merge 1 commit intobobthecow:mainfrom
Conversation
|
Mustache.php used to come with its own autoloader (up until ~3 months ago). I removed it in v3.x because in the year 2025 everyone's either using Composer, or has some other way of loading PHP files. I'm not sure we need to maintain another autoloader :) |
|
Personally I would definitely use a non-composer loader if it were an option. Smarty makes it easy to not use composer, so I was looking at feature parity. Often I'm working on small projects with no dependencies and bringing composer into the mix just complicates things. |
|
Composer makes DLL hells from the 90s look like cakewalks in the park, people just refuse to face their own responsibilities for all things happening deep down in the depedency stack, potentially leading to things breaking in ways which are hard to discover. Security isn't part of the composer concept at all, which is, IMHO, a big step backwards. Not having any unnecessary dependency is one of the reason why I prefer mustache over other solutions. Yet this autoloader is opening an issue: There are also people using php on systems where 'directory separator is not /', lines 9 and 24 break that. There's "DIRECTORY_SEPARATOR", if you need a directory separator for the current system php is running on. |
This should address #430. It ended up being simpler than I thought it would be. We do need an
include()target so I went withsrc/mustache.phpbut it could be anything.start.phploader.phpThis makes the path human consumable / parseable
require_once("/path/to/mustache/src/mustache.php");. This should facilitate a user cloning the repository or downloading the latest release.zipfile.