Download the PHP package gioppy/statamic-rest-client without Composer

On this page you can find all versions of the php package gioppy/statamic-rest-client. 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 statamic-rest-client

This package provide a simple client for Statamic REST API.

It was created primarily for use on SSG php systems, such as Jigsaw, but can be used in any context.

Installation

composer require gioppy/statamic-rest-client

The package needs at least php 8.1, and depend on guzzlehttp/guzzle and illuminate/collections.

How to use

After installed, you can create new client with a classic new operator

new StatamicRestClient(...)

or with a static method

StatamicRestClient::make(...)

You can pass two values: the host of your Statamic installation (e.g: https://www.my-statmic.com) and optionally the API endpoint path (default is api but you can customize on Statamic API config).

Filters

You can filter the api using ->where() method in two possible ways. You can filter single value

or using a condition

Sorting

You can sort the response using ->sort() method, passing an array of fields:

Selecting fields

You can specify what fields should be included on response using ->fields() method, passing an array of fields:

Pagination

You can paginate the response using ->paginate() method, passing the number of items you want and, optionally, the number of page:

Entries / Entry

Get all entries of collection:

Get an entry from a collection:

Collection Tree

TODO

Navigation Tree

Taxonomy Terms / Taxonomy Term

Get all terms of taxonomy:

Get a single term from taxonomy:

Globals / Global

Get all globals:

Get single global:

Assets / Asset

Get all assets of one container:

Get single asset:

Get single asset by its id:

The id of an asset is formatted by Statamic as container::path.

Getting response

You can get all response as array, including links and other nodes with ->all() method

or you can get only data node with ->data() method

If you need to have data as collection you can us ->toCollection() method

Integration with Statamic Glide Rest

Statami Glide Rest is a small addon for Statamic that expose glide manipulation presets on a REST API endpoint. You can get an asset response with a glide presets with the class StatamicGlideRest:

TODO


All versions of statamic-rest-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1.0
guzzlehttp/guzzle Version ^7.8
illuminate/collections Version ^9.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 gioppy/statamic-rest-client contains the following files

Loading the files please wait ....