Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a PSR-4 loading script to allow Smarty to be used without Composer #1017

Closed
wants to merge 6 commits into from

Conversation

scottchiefbaker
Copy link

This is to help address #999. I created a fake "class" script that acts as a PSR-4 loading script. For Smarty 3.x and 4.x I would instantiate Smarty with:

require("include/smarty/libs/Smarty.class.php");
$smarty = new Smarty();

With this new script I can instantiate Smarty 5.x with:

require("include/smarty/src/Smarty.class.php");
$smarty = new Smarty\Smarty();

This should help backwards compatible usability for old users like me. It'd be great if this script could live in /libs/ to be 99% backwards compatible, but that directory doesn't exist anymore.

@scottchiefbaker
Copy link
Author

Would you consider letting me recreate the /libs/ directory and putting this file in there? That would make this almost a drop in replacement for Smart 3.x and 4.x for us non-composer users. Then the only difference would be:

$smarty = new Smarty(); // Smarty 3.x and 4.x

// Versus

$smarty = new Smarty\Smarty(); // Smarty 5.x

@wisskid
Copy link
Contributor

wisskid commented May 15, 2024

Yes, that seems fine!

@scottchiefbaker
Copy link
Author

Excellent. I recreated the libs/ folder and put the PSR-4 file in there. I've tested the changes and everything seems to be working now.

libs/Smarty.class.php Outdated Show resolved Hide resolved
libs/Smarty.class.php Outdated Show resolved Hide resolved
@scottchiefbaker
Copy link
Author

PR updated with your requested fixes.

@scottchiefbaker
Copy link
Author

@wisskid do you need anything else from me on this?

@wisskid
Copy link
Contributor

wisskid commented May 24, 2024

@scottchiefbaker this has been merged (with a changelog) as #1019. Thanks!

@wisskid wisskid closed this May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants