Download the PHP package lukeyouell/craft-fetch without Composer

On this page you can find all versions of the php package lukeyouell/craft-fetch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package craft-fetch

[!WARNING] This plugin has been abandoned.


Fetch plugin for Craft CMS

Why this plugin is retired

Fetch made synchronous, uncached HTTP requests during Twig rendering. That was a convenient shortcut in 2018, but it's now a well-documented performance anti-pattern: every page render blocks on the external API, and if that API slows down or goes down, so does your site. Craft can also now do everything this plugin did natively, with no plugin installed.

Migrating away from Fetch

Option 1: Native Twig (direct replacement)

Guzzle ships with Craft, and Craft's create() Twig function can instantiate it — no plugin required. This is a drop-in replacement for what Fetch did:

{% set client = create('GuzzleHttp\\Client') %}

{% set response = client.request('GET', 'https://api.example.com/endpoint', {
    timeout: 5,
    http_errors: false,
}) %}

{% if response.getStatusCode() == 200 %}
    {% set data = response.getBody().getContents() | json_decode %}
{% endif %}

Note that this has the same drawback Fetch had: it blocks the render. If you use it, wrap the output in a {% cache %} tag at minimum.

Option 2: Do it properly (recommended for production)

Option 3: Maintained plugin alternatives

Thanks

Thanks to Luke Youell for creating this plugin, and to everyone who used and contributed to it over the years.


All versions of craft-fetch with dependencies

PHP Build Version
Package Version
Requires craftcms/cms Version ^4.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lukeyouell/craft-fetch contains the following files

Loading the files please wait ...