First, you need to extend and use a third-party class library outside of the core, and the class library is not installed through composer, so you can put it directly under the Extend directory under the app root directory, which is the officially recommended third-party extension class Library directory.
The naming conventions of the classes follow the PSR-2 and PSR-4 specifications, taking care not to create conflicts with the system's namespaces, such as the core think, the app, and the namespace defined by the composer Class library itself.
For example, if you have an extension class library with a namespace of First.second.Foo, the class is defined as follows:
namespace First\second;
Class Foo
{
}
Then the actual class file location should be: extend/first/second/foo.php
Three, three kinds of reference methods of First.second.Foo class
(1) Direct instantiation can be used:
$foo = new \first\second\foo ();
(2) referencing namespaces in the head
Use First\second\foo;
$foo = new Foo ();
(3) Class library does not use namespaces
Loader::import (' First.second.Foo ');
$foo = new \foo ();
THINKPHP5 introduction of third-party class library methods