Jump to content

Better class autoloading

Recommended Posts

Hey everyone,

this week I found the time to write some modules and came up with something that I think could be greatly improved in ProcessWire. In my opinion when developing PHP applications today there should barely be the need to manually require files that contain classes anymore. Instead this should be handled by an autoloading function and probably by more strictly following a fixed PSR naming guideline.

In ProcessWire as developers we unfortunately still have to manually require files which, besides from feeling somewhat dirty, has two major drawbacks:
1) files get loaded even when not needed to process the current request
2) file includes are all over the place and also have to be considered when refactoring



Share this post

Link to post
Share on other sites

There‘s the $classLoader class in the core if you need to setup autoloading.

  • Like 4

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...