ringcentral - Whether require and use are similiar in php? -
use ringcentral\sdk;
or
require('/home/developer/workspace/ringcentral/demo/sdk.php');
instead of using 'use' - php 5.6 command ,it better use require - php 5.3 ?
sdk class file contains following code
class sdk { const version = '0.5.0'; /** @var platform */ protected $platform; /** @var context */ protected $context; public function __construct($appkey, $appsecret, $server) { $this->context = new context(); $this->platform = new platform($this->context, $appkey, $appsecret, $server); } public function getplatform() { return $this->platform; } public function getsubscription() { return new subscription($this->context, $this->platform); } public function getcontext() { return $this->context; } }
you have require autoloader allow spl autoload resolve use statements:
// if use composer require('vendor/autoload.php'); // or require phar require('path-to-sdk/ringcentral.phar'); use ringcentral\sdk\sdk; $sdk = new sdk(...);
you may omit use statement , use fully-qualified class name:
$sdk = new ringcentral\sdk\sdk(...);
Comments
Post a Comment