code-rhapsodie / get-url-contents-ez-twig-bundle
Package info
github.com/code-rhapsodie/get-url-contents-ez-twig-bundle
Type:symfony-bundle
pkg:composer/code-rhapsodie/get-url-contents-ez-twig-bundle
v1.0.1
2020-09-02 14:39 UTC
Requires
- php: ^7.0
- ext-curl: *
- symfony/dependency-injection: ^3.4||^4.0||^5.0
- symfony/twig-bundle: ^3.4||^4.0||^5.0
This package is auto-updated.
Last update: 2026-02-11 02:52:34 UTC
README
This bundle adds:
- a
get_url_contentsTwig function - a
get_url_contentseZ Publish legacy template operator
Both share the same behaviour:
- perform a GET HTTP request to the URL passed as argument, using curl
- then, if the request succeeded and the response code is 200, return the response body as string
- otherwise, return an empty string
Install
Just use Composer:
composer require code-rhapsodie/get-url-contents-ez-twig-bundle
Usage
In Twig:
{{ get_url_contents('https://host/my_external_file.html') }}
In eZ Publish legacy templates:
{get_url_contents('https://host/my_external_file.html')}