[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/ocramius/proxy-manager/html-docs/ -> remote-object.html (source)

   1  <!DOCTYPE html>
   2  <html class="no-js" id="top">
   3  <head>
   4      <title>ProxyManager - Remote object</title>
   5  
   6      <meta name="description" content="A proxyManager write in php" />
   7      <meta name="keywords" content="ProxyManager, proxy, manager, ocramius, Marco Pivetta, php, remote object" />
   8      <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
   9      <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600' rel='stylesheet' type='text/css'>
  10      <link href="css/styles.css" rel="stylesheet" />
  11      <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/default.min.css">
  12      <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js"></script>
  13      <script>hljs.initHighlightingOnLoad();</script>
  14      <link rel="shortcut icon" href="favicon.ico">
  15  </head>
  16  <body>
  17  
  18  <header class="site-header">
  19  <div class="container">
  20  <h1><a href="index.html"><img alt="ProxyManager" src="img/block.png" /></a></h1>
  21  
  22  <nav class="main-nav" role="navigation">
  23  <ul>
  24      <li><a href="https://github.com/Ocramius/ProxyManager" target="_blank">Github</a>
  25      <div class="bcms-clearfix"></div>
  26  </li>
  27  </ul>
  28  </nav>
  29  </div>
  30  </header>
  31  <main role="main">
  32  <section class="component-content">
  33  
  34  <div class="component-demo" id="live-demo">
  35      <div class="container">
  36              <div class="main-wrapper" style="text-align: right">
  37                  <iframe src="http://ghbtns.com/github-btn.html?user=ocramius&amp;repo=ProxyManager&amp;type=fork&amp;count=true&amp;size=large"
  38    allowtransparency="true" frameborder="0" scrolling="0" width="310" height="40"></iframe>
  39  
  40                  <iframe src="http://ghbtns.com/github-btn.html?user=ocramius&amp;repo=ProxyManager&amp;type=watch&amp;count=true&amp;size=large"
  41    allowtransparency="true" frameborder="0" scrolling="0" width="200" height="40"></iframe>
  42  
  43              </div>
  44          <div class="bcms-clearfix bcms-clearfix"></div>
  45      </div>
  46  </div>
  47  <div class="component-info">
  48  <div class="container">
  49  <aside class="sidebar">
  50      <nav class="spy-nav">
  51          <ul>
  52              <li><a href="index.html">Intro</a></li>
  53              <li><a href="virtual-proxy.html">Virtual Proxy</a></li>
  54              <li><a href="null-object.html">Null Objects</a></li>
  55              <li><a href="ghost-object.html">Ghost Objects</a></li>
  56              <li><a href="remote-object.html">Remote Object</a></li>
  57              <li><a href="contributing.html">Contributing</a></li>
  58              <li><a href="credits.html">Credits</a></li>
  59              <li><a href="copyright.html">Copyright</a></li>
  60          </ul>
  61      </nav>
  62  <div class="bcms-clearfix bcms-clearfix"></div>
  63  <a class="btn btn-action btn-full download-component"
  64      href="download.html">Download</a>
  65      <div class="bcms-clearfix"></div>
  66  </aside>
  67  
  68  <div class="content">
  69      <div class="bcms-clearfix"></div>
  70      <h3 class="section-title">Remote Object Proxy</h3>
  71  
  72      <p>The remote object implementation is a mechanism that enables an local object to control an other object on an other server. Each call method on the local object will do a network call to get information or execute operations on the remote object.</p>
  73  <hr />
  74  
  75      <h3 class="section-title">What is remote object proxy ?</h3>
  76  
  77      <p>A remote object is based on an interface. The remote interface defines the API that a consumer can call. This interface must be implemented both by the client and the RPC server.</p>
  78  <hr />
  79  
  80      <h3 class="section-title">Adapters</h3>
  81  
  82      <p>ZendFramework's RPC components (XmlRpc, JsonRpc &amp; Soap) can be used easily with the remote object. You will need to require the one you need via composer, though:</p>
  83  
  84      <pre>
  85          <code class="sh">
  86  $ php composer.phar require zendframework/zend-xmlrpc:2.*
  87  $ php composer.phar require zendframework/zend-json:2.*
  88  $ php composer.phar require zendframework/zend-soap:2.*
  89          </code>
  90      </pre>
  91  
  92      <p>ProxyManager comes with 3 adapters:</p>
  93  
  94      <ul>
  95          <li><code>ProxyManager\Factory\RemoteObject\Adapter\XmlRpc</code></li>
  96          <li><code>ProxyManager\Factory\RemoteObject\Adapter\JsonRpc</code></li>
  97          <li><code>ProxyManager\Factory\RemoteObject\Adapter\Soap</code></li>
  98      </ul>
  99  
 100  <hr />
 101  
 102      <h3 class="section-title">Usage examples</h3>
 103  
 104      <p>RPC server side code (<code>xmlrpc.php</code> in your local webroot):</p>
 105  
 106      <pre>
 107          <code class="php">
 108  interface FooServiceInterface
 109  {
 110      public function foo();
 111  }
 112  
 113  class Foo implements FooServiceInterface
 114  {
 115      /**

 116       * Foo function

 117       * @return string

 118       */
 119      public function foo()
 120      {
 121          return 'bar remote';
 122      }
 123  }
 124  
 125  $server = new Zend\XmlRpc\Server();
 126  $server->setClass('Foo', 'FooServiceInterface');  // my FooServiceInterface implementation

 127  $server->handle();
 128          </code>
 129      </pre>
 130  
 131      <p>Client side code (proxy) :</p>
 132  
 133      <pre>
 134          <code class="php">
 135  interface FooServiceInterface
 136  {
 137      public function foo();
 138  }
 139  
 140  $factory = new \ProxyManager\Factory\RemoteObjectFactory(
 141      new \ProxyManager\Factory\RemoteObject\Adapter\XmlRpc(
 142          new \Zend\XmlRpc\Client('https://localhost/xmlrpc.php')
 143      )
 144  );
 145  
 146  $proxy = $factory->createProxy('FooServiceInterface');
 147  
 148  var_dump($proxy->foo()); // "bar remote"

 149          </code>
 150      </pre>
 151  <hr />
 152  
 153      <h3 class="section-title">Implementing custom adapters</h3>
 154  
 155      <p>Your adapters must implement <code>ProxyManager\Factory\RemoteObject\AdapterInterface</code> :</p>
 156  
 157      <pre>
 158          <code class="php">
 159  interface AdapterInterface
 160  {
 161      /**

 162       * Call remote object

 163       *

 164       * @param string $wrappedClass

 165       * @param string $method

 166       * @param array $params

 167       *

 168       * @return mixed

 169       */
 170      public function call($wrappedClass, $method, array $params = array());
 171  }
 172          </code>
 173      </pre>
 174  
 175      <p>It is very easy to create your own implementation (for RESTful web services, for example). Simply pass your own adapter instance to your factory at construction time</p>
 176  
 177      <p>Tuning performance for production</p>
 178  
 179      <p>See <a href="production.html">Tuning ProxyManager for Production.</a></p>
 180  
 181  </main>
 182  
 183      <footer class="site-footer" role="contentinfo">
 184          <div class="container">
 185              <div class="footer-logos">
 186                  <ul>
 187                      <li><a href="index.html">Intro</a> | </li>
 188                      <li><a href="virtual-proxy.html">Virtual Proxy</a> | </li>
 189                      <li><a href="null-object.html">Null Objects</a> | </li>
 190                      <li><a href="ghost-object.html">Ghost Objects</a> | </li>
 191                      <li><a href="remote-object.html">Remote Object</a> | </li>
 192                      <li><a href="contributing.html">Contributing</a> | </li>
 193                      <li><a href="credits.html">Credits</a> | </li>
 194                      <li><a href="copyright.html">Copyright</a></li>
 195                  </ul>
 196              </div>
 197          </div>
 198  
 199          <div class="bcms-clearfix"></div>
 200      </footer>
 201      <div class="bcms-clearfix"></div>
 202      </body>
 203  </html>


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1