Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
index.html
001 <!DOCTYPE html>
002 <html class="no-js" id="top">
003 <head>
004 <title>ProxyManager</title>
005
006 <meta name="description" content="A proxyManager write in php" />
007 <meta name="keywords" content="ProxyManager, proxy, manager, ocramius, Marco Pivetta, php" />
008 <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
009 <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600' rel='stylesheet' type='text/css'>
010 <link href="css/styles.css" rel="stylesheet" />
011 <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/default.min.css">
012 <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js"></script>
013 <script>hljs.initHighlightingOnLoad();</script>
014 <link rel="shortcut icon" href="favicon.ico">
015 </head>
016 <body>
017
018 <header class="site-header">
019 <div class="container">
020 <h1><a href="index.html"><img alt="ProxyManager" src="img/block.png" /></a></h1>
021
022 <nav class="main-nav" role="navigation">
023 <ul>
024 <li><a href="https://github.com/Ocramius/ProxyManager" target="_blank">Github</a>
025 <div class="bcms-clearfix"></div>
026 </li>
027 </ul>
028 </nav>
029 </div>
030 </header>
031 <main role="main">
032 <section class="component-content"><div class="page-title-wrapper">
033 <div class="container">
034 <img src="https://github.com/Ocramius/ProxyManager/raw/master/proxy-manager.png">
035 <h2 class="page-title">Proxy Manager</h2>
036 </div>
037 </div>
038
039 <div class="component-demo" id="live-demo">
040 <div class="container">
041 <div class="main-wrapper" style="text-align: right">
042 <iframe src="http://ghbtns.com/github-btn.html?user=ocramius&repo=ProxyManager&type=fork&count=true&size=large"
043 allowtransparency="true" frameborder="0" scrolling="0" width="310" height="40"></iframe>
044
045 <iframe src="http://ghbtns.com/github-btn.html?user=ocramius&repo=ProxyManager&type=watch&count=true&size=large"
046 allowtransparency="true" frameborder="0" scrolling="0" width="200" height="40"></iframe>
047
048 </div>
049 <div class="bcms-clearfix bcms-clearfix"></div>
050 </div>
051 </div>
052 <div class="component-info">
053 <div class="container">
054
055 <aside class="sidebar">
056 <nav class="spy-nav">
057 <ul>
058 <li><a href="index.html">Intro</a></li>
059 <li><a href="virtual-proxy.html">Virtual Proxy</a></li>
060 <li><a href="null-object.html">Null Objects</a></li>
061 <li><a href="ghost-object.html">Ghost Objects</a></li>
062 <li><a href="remote-object.html">Remote Object</a></li>
063 <li><a href="contributing.html">Contributing</a></li>
064 <li><a href="credits.html">Credits</a></li>
065 <li><a href="copyright.html">Copyright</a></li>
066 </ul>
067 </nav>
068 <div class="bcms-clearfix bcms-clearfix"></div>
069 <a class="btn btn-action btn-full download-component"
070 href="download.html">Download</a>
071 <div class="bcms-clearfix"></div>
072 </aside>
073
074 <div class="content">
075 <h3>Proxy Manager</h3>
076 <p>This library aims at providing abstraction for generating various kinds of <a href="http://ocramius.github.io/presentations/proxy-pattern-in-php/" target="_blank">proxy classes</a>.</p>
077 <p>If you want to learn more about proxy pattern watch this video:</p>
078
079 <iframe width="640" height="390" src="//www.youtube.com/embed/Ka8wlV8M6Vg" frameborder="0" allowfullscreen></iframe>
080 <hr />
081 <div class="bcms-clearfix"></div>
082 <h3 class="section-title">Installation</h3>
083 <p>The suggested installation method is via <a href="https://getcomposer.org/" target="_blank">composer</a>.</p>
084 <pre><code class="sh">php composer.phar require ocramius/proxy-manager:1.0.*</code></pre>
085 <hr />
086
087 <h3 class="section-title" id="virtualproxy">Lazy Loading Value Holders (Virtual Proxy)</h3>
088
089 <p>ProxyManager can generate
090 <a href="http://www.martinfowler.com/eaaCatalog/lazyLoad.html" target="_blank">lazy loading value holders</a>,
091 which are virtual proxies capable of saving performance and memory for objects that
092 require a lot of dependencies or CPU cycles to be loaded:
093 particularly useful when you may not always need the object,
094 but are constructing it anyways.</p>
095
096 <pre>
097 <code class="php">
098 $factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory();
099
100 $proxy = $factory->createProxy(
101 'MyApp\HeavyComplexObject',
102 function (& $wrappedObject, $proxy, $method, $parameters, & $initializer) {
103 $wrappedObject = new HeavyComplexObject(); // instantiation logic here
104 $initializer = null; // turning off further lazy initialization
105
106 return true;
107 }
108 );
109
110 $proxy->doFoo();
111 </code>
112 </pre>
113
114 <p>See the <a href="virtual-proxy.html">complete documentation about lazy loading value holders</a>.</p>
115 <hr />
116
117 <h3 class="section-title">Access Interceptor Value Holder</h3>
118
119 <p>An access interceptor value holder is a smart reference that allows you to execute
120 logic before and after a particular method is executed or a particular property is
121 accessed, and it allows to manipulate parameters and return values depending on
122 your needs.</p>
123
124 <pre>
125 <code class="php">
126 $factory = new \ProxyManager\Factory\AccessInterceptorValueHolderFactory();
127
128 $proxy = $factory->createProxy(
129 new \My\Db\Connection(),
130 array('query' => function () { echo "Query being executed!\n"; }),
131 array('query' => function () { echo "Query completed!\n"; })
132 );
133
134 $proxy->query(); // produces "Query being executed!\nQuery completed!\n"
135 </code>
136 </pre>
137
138 <p>See the <a href="access-interceptor-value-holder-proxy.html">complete documentation about access interceptor value holders</a>.</p>
139 <hr />
140
141 <h3 class="section-title">Access Interceptor Scope Localizer</h3>
142
143 <p>An access interceptor scope localizer works exactly like an access interceptor
144 value holder, but it is safe to use to proxy fluent interfaces.</p>
145
146 <p>See the <a href="access-interceptor-scope-localizer-proxy.html">complete documentation about access interceptor scope localizer</a>.</p>
147 <hr />
148
149
150 <h3 class="section-title">Null Objects</h3>
151
152 <p>A Null Object proxy implements the null object pattern.</p>
153
154 <p>This kind of proxy allows you to have fallback logic in case loading of the wrapped value failed.</p>
155 <pre>
156 <code class="php">
157 $factory = new \ProxyManager\Factory\NullObjectFactory();
158
159 $proxy = $factory->createProxy('My\EntityObject');
160
161 $proxy->getName(); // empty return
162 </code>
163 </pre>
164
165 <p>A Null Object Proxy can be created from an object, a class name or an interface name:</p>
166 <pre>
167 <code class="php">
168 $factory = new \ProxyManager\Factory\NullObjectFactory();
169
170 $proxy = $factory->createProxy('My\EntityObjectInterface');
171 $proxy->getName(); // empty return
172
173 $proxy = $factory->createProxy($entity); // created from object
174 $proxy->getName(); // empty return
175 </code>
176 </pre>
177
178 <p>See the <a href="null-object.html">complete documentation about null object proxy</a>.</p>
179
180 <hr />
181
182 <h3 class="section-title">Ghost Objects</h3>
183
184 <p>Similar to value holder, a ghost object is usually created to handle lazy loading.</p>
185
186 <p>The difference between a value holder and a ghost object is that the ghost
187 object does not contain a real instance of the required object, but handles
188 lazy loading by initializing its own inherited properties.</p>
189
190 <p>ProxyManager can generate
191 <a href="http://www.martinfowler.com/eaaCatalog/lazyLoad.html" target="_blank">lazy loading ghost objects</a>,
192 which are proxies used to save performance and memory for large datasets and
193 graphs representing relational data. Ghost objects are particularly useful
194 when building data-mappers.</p>
195
196 <p>Additionally, the overhead introduced by ghost objects is very low when
197 compared to the memory and performance overhead caused by virtual proxies.</p>
198
199 <pre>
200 <code class="php">
201 $factory = new \ProxyManager\Factory\LazyLoadingGhostFactory();
202
203 $proxy = $factory->createProxy(
204 'MyApp\HeavyComplexObject',
205 function ($proxy, $method, $parameters, & $initializer) {
206 $initializer = null; // turning off further lazy initialization
207
208 // modify the proxy instance
209 $proxy->setFoo('foo');
210 $proxy->setBar('bar');
211
212 return true;
213 }
214 );
215
216 $proxy->doFoo();
217 </code>
218 </pre>
219
220 <p>See the <a href="ghost-object.html">complete documentation about lazy loading ghost objects</a>.</p>
221
222 <hr />
223
224 <h3 class="section-title">Remote Object</h3>
225
226 <p>A remote object proxy is an object that is located on a different system,
227 but is used as if it was available locally. There's various possible
228 remote proxy implementations, which could be based on xmlrpc/jsonrpc/soap/dnode/etc.</p>
229
230 <p>This example uses the XML-RPC client of Zend Framework 2:</p>
231
232 <pre>
233 <code class="php">
234 interface FooServiceInterface
235 {
236 public function foo();
237 }
238
239 $factory = new \ProxyManager\Factory\RemoteObjectFactory(
240 new \ProxyManager\Factory\RemoteObject\Adapter\XmlRpc(
241 new \Zend\XmlRpc\Client('https://example.com/rpc-endpoint')
242 )
243 );
244
245 // proxy is your remote implementation
246 $proxy = $factory->createProxy('FooServiceInterface');
247
248 var_dump($proxy->foo());
249 </code>
250 </pre>
251
252 <p>See the <a href="remote-object.html">complete documentation about remote objects</a>.</p>
253 <hr />
254
255
256 <h3 class="section-title">Contributing</h3>
257 <p>Please read the <a href="contributing.html">CONTRIBUTING</a> contents if you wish to help out!</p>
258
259 <hr />
260
261 <h3 class="section-title">Credits</h3>
262
263 <p>The idea was originated by a <a href="http://marco-pivetta.com/proxy-pattern-in-php/" target="_blank">talk about Proxies in PHP OOP</a> that I gave at the <a href="https://twitter.com/phpugffm" target="_blank">@phpugffm</a> in January 2013.</p>
264
265
266 <div class="bcms-clearfix"></div>
267
268 </div>
269 </div>
270 </div>
271
272
273 </main>
274
275 <footer class="site-footer" role="contentinfo">
276 <div class="container">
277 <div class="footer-logos">
278 <ul>
279 <li><a href="index.html">Intro</a> | </li>
280 <li><a href="virtual-proxy.html">Virtual Proxy</a> | </li>
281 <li><a href="null-object.html">Null Objects</a> | </li>
282 <li><a href="ghost-object.html">Ghost Objects</a> | </li>
283 <li><a href="remote-object.html">Remote Object</a> | </li>
284 <li><a href="contributing.html">Contributing</a> | </li>
285 <li><a href="credits.html">Credits</a> | </li>
286 <li><a href="copyright.html">Copyright</a></li>
287 </ul>
288 </div>
289 </div>
290
291 <div class="bcms-clearfix"></div>
292 </footer>
293 <div class="bcms-clearfix"></div>
294 </body>
295 </html>
296