https://github.com/crazy-goat/octophpus
Asynchronous ESI filter for PHP 7.1+
https://github.com/crazy-goat/octophpus
async asynchronous culr esi guzzle php varnish
Last synced: about 1 month ago
JSON representation
Asynchronous ESI filter for PHP 7.1+
- Host: GitHub
- URL: https://github.com/crazy-goat/octophpus
- Owner: crazy-goat
- License: mit
- Created: 2017-05-27T10:38:22.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-24T05:07:04.000Z (about 9 years ago)
- Last Synced: 2025-12-14T18:12:04.384Z (7 months ago)
- Topics: async, asynchronous, culr, esi, guzzle, php, varnish
- Language: PHP
- Homepage:
- Size: 49.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/crazy-goat/octophpus)
[](https://coveralls.io/github/crazy-goat/octophpus?branch=master)
[](https://scrutinizer-ci.com/g/crazy-goat/octophpus/?branch=master)
# Octophpus
Asynchronous ESI filter for PHP 7.1+. Its scans string for `esi:include` tags
and replace with remote content. It's a simple replace for varnish server just for
including esi content. The killer feature is that all request are made
asynchronous, so it should be **faster than varnish**.
**No that this version is just proof of concept. For production implementation
wait for Octophpus 0.5.**
## Requirements
* PHP 7.1
* Guzzle 6
* cURL extension for PHP. _Octopus will run without cURL, but multiple request will not work_
## Installation
The recommended way to install Octophpus is through [Composer](http://getcomposer.org).
```bash
php composer.phar require crazygoat/octophpus
```
To upgrade to newest version execute:
```bash
php composer.phar update crazygoat/octophpus
```
## Example code
```php
include_once "../vendor/autoload.php";
$text = '';
$octophpus = new \CrazyGoat\Octophpus\EsiTentacles();
echo $octophpus->decorate($text);
```
## Limitations
* Octophpus only handle `esi:include` from ESI spec.
* All `esi:include` tags must contains full uri in `src` attribute. Uri
**must** contain protocol, domain name and path. See below.
* If data string contains two or `esi:include` tags with same `src` Octophpus
will make multiple requests.
## ESI tag format
Octophpus does not cover full specification [ESI RFC](https://www.w3.org/TR/esi-lang).
It also adds some `esi:include` parameters that are not part of RFC.
Minimal valid `esi:include` is listed below:
```html
^ ^ ^
1 2 3
```
1. `esi:include` tag name, it is no case sensitive.
1. `src` must contains full URI.
1. Tag must end with `/>`. Tags like this ``
will not work
Multi-line tag will work, so if you want to pass more parameters you can split it
to more lines:
```html
```
## Roadmap
List of features to be add in the near feature. _This list is not ordered._
* New features
* Add caching - use PSR-7 cache interface
* Add [hxInclude](http://mnot.github.io/hinclude/) option on timeout
* Add option to pass headers to requests (for example cookies, x-forwared-proto)
* Add recurrence ESI requests
* Deployment and maintenance
* Prepare roadmap ticket, and remove this stuff
* Travis - form running tests
* Docs and examples
* Create super duper logo
* Add better docs
* Add more examples
* Add basic test