I have a question. . My project loads classes purely through a custom namespace. Then I will introduce a third-party class library. This class library is loaded according to the PSR-4 specification. In this case. How can I reference this third-party class library in the project without changing my original loading rules?
阿神2017-05-27 17:45:28
Composer introduces a third-party class library, and introduces composer's autoload.php in the entry file to automatically load the file
PHP中文网2017-05-27 17:45:28
First require the third-party class library, and then use it. Then you can instantiate this class, for example:
<?php
namespace common\services\money;
require_once ROOT_PATH . '/extensions/payssion/lib/PayssionClient.php';
use PayssionClient;
class PayssionService
{
public function test()
{
$payssion = new PayssionClient();
}
}