WordPress Standard Plugin with Support PSR-4 autoloading.
This PSR describes a specification for autoloading classes from file paths. It is fully interoperable, and can be used in addition to any other autoloading specification, including PSR-0. This PSR also describes where to place files that will be autoloaded according to the specification.
In the below you can see the folder structure and classes:
includes
├── Folder
│ └── Test.php
└── Folder2
└── Test2.php
The example of the Test.php
namespace Folder;
class Test
{
/**
* @return string
*/
public static function getHelloWorld()
{
return 'Hello World!';
}
}
And you can run above class in your code with below command:
echo Folder\Test::getHelloWorld();