Wp Autoload with Namespaces
Wp Autoload with Namespaces (For better and clean plugin code using OOP)
by Imran Zahoor · github.com/mrimran/wpal-autoload · website
★ 0stars
98composer installs
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/mrimran/wpal-autoload/archive/refs/heads/master.zipAlso on Packagist as wpackagist-plugin/wpal-autoload:
composer require wpackagist-plugin/wpal-autoloadFrom the readme
A plugin to write better plugin code (Written for Developers by a Developer)
A Plugin that is going facilitate use of Namespaces and making it easier to load files using Namespaces in other plugins.
It makes possible to get rid of includeonce, requireonce, include and require as all of these methods make your code
look uglier and it becomes difficult to maintain that code. As to include other classes or functions properly you need
to append some paths and then have to mention the file name with the exact path.
This plugin needs you freedom of writing your code and organizing it based on your needed directory structure.
Guidlines
The only guidelines you need to follow are below:
- Namespace your classes and functions which you are separating so anything placed in
wp-content/plugins/TestPlugin/inc should be namespaced as TestPlugin\inc.
Whereas anything placed in wp-content/plugins/TestPlugin/Inc would be namespaced as TestPlugin\Inc.
- Filename should be same as of class name, but case doesn't matter because if Class name is
Test and the file name is test.php, the autoloader would still be able to load the correct file.
Usage
Now it's time to see how it'll help you to
Read the full README on GitHub →
Releases
| Tag | Published |
|---|---|
| 1.1.2 | Feb 13, 2018 |
| 1.1.1 | Feb 13, 2018 |
| 1.1.0 | Feb 13, 2018 |
| 1.0.8 | Jul 26, 2017 |
| 1.0.1 | May 23, 2017 |
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.