Skip to content

Commit bc72a02

Browse files
committed
Merge branch 'master' of https://github.com/Athlon1600/php-proxy
2 parents c85153e + 393cb32 commit bc72a02

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,35 @@ $response->send();
6565

6666
```
6767

68+
Plugin Example
69+
--------
70+
71+
```php
72+
namespace Proxy\Plugin;
73+
74+
use Proxy\Plugin\AbstractPlugin;
75+
use Proxy\Event\ProxyEvent;
76+
77+
use Proxy\Html;
78+
79+
class MultiSiteMatchPlugin extends AbstractPlugin {
80+
81+
// Matches multiple domain names (abc.com, abc.de, abc.pl) using regex (you MUST use / character)
82+
protected $url_pattern = '/^abc\.(com|de|pl)$/is';
83+
// Matches a single domain name
84+
//protected $url_pattern = 'abc.com';
85+
86+
public function onCompleted(ProxyEvent $event){
87+
88+
$response = $event['response'];
89+
90+
$html = $response->getContent();
91+
92+
// do your stuff here...
93+
94+
$response->setContent($html);
95+
}
96+
}
97+
```
98+
99+
Notice that you must use the **/** character for regexes on ```$url_pattern```

0 commit comments

Comments
 (0)