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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -