PHPackages                             pablo-sg-pacheco/wp-namespace-autoloader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. pablo-sg-pacheco/wp-namespace-autoloader

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pablo-sg-pacheco/wp-namespace-autoloader
========================================

A PHP autoloader class that follows the WordPress coding standards 2.0 and proposed 3.0 for class/interface/trait names and filenames

4234.3k↓22.2%9[5 issues](https://github.com/pablo-sg-pacheco/wp-namespace-autoloader/issues)[1 PRs](https://github.com/pablo-sg-pacheco/wp-namespace-autoloader/pulls)2PHPCI failing

Since Dec 2Pushed 3y ago3 watchersCompare

[ Source](https://github.com/pablo-sg-pacheco/wp-namespace-autoloader)[ Packagist](https://packagist.org/packages/pablo-sg-pacheco/wp-namespace-autoloader)[ RSS](/packages/pablo-sg-pacheco-wp-namespace-autoloader/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (2)

wp-namespace-autoloader
=======================

[](#wp-namespace-autoloader)

A PHP autoloader class that follows the WordPress coding standards 2.0 applying PSR-4 specification and optionally supports proposed 3.0

**Description**
===============

[](#description)

Namespaces and autoloaders are cool and help organizing your code. With these features you don't have to worry about including and requiring php files manually ever again and your code gets organized in folders.

This is a [PSR-4](http://www.php-fig.org/psr/psr-4/) autoloader implementation following [WordPress naming conventions 2.0](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#naming-conventions) and proposed [WordPress naming conventions 3.0](https://make.wordpress.org/core/2020/03/20/updating-the-coding-standards-for-modern-php)

It means I'm doing these things:

- Converting classes filenames to lowercase
- Replacing underscores on class filenames by hyphens
- Prepending 'class-' before the final class name
- \[Optional\]: Prepending 'interface-' before the final interface name
- \[Optional\]: Prepending 'trait-' before the final trait name

**Note**
--------

[](#note)

- Required PHP Version is PHP 5.4

**Installation**
================

[](#installation)

You just have to require it just like a composer default dependency. You may have to use **preferred-install** as **dist** so you will be able to commit files as .git files will not be created

```
"require": {
	"pablo-sg-pacheco/wp-namespace-autoloader": "dev-master"
},
"config": {
	"preferred-install": "dist"
}
```

**Usage**
=========

[](#usage)

Firstly, load the composer dependencies like you are used to

```
