Download the PHP package laraluke/statamic-api-select without Composer
On this page you can find all versions of the php package laraluke/statamic-api-select. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package statamic-api-select
API Select Fieldtype addon for Statamic
Utilise API endpoints for your Select Fieldtype options.
License
API Select requires a license.
You can purchase one at https://statamic.com/marketplace/addons/api-select
You may use API Select without a license while Statamic is in Trial mode.
Installation
Require it using Composer.
Publish the assets:
Using the API Select Fieldtype
Add the fieldtype to your fieldset/blueprint. You will then need to configure the following settings:
Endpoint Type
This is to define whether or not your endpoint value is a URL or a config variable.
Endpoint
If your endpoint type is a URL your endpoint value will look like this:
If your endpoint type is a config variable your endpoint value will look like this:
and your endpoints.php
file would look something like this:
Cache Duration
This is how long API requests will be cached for in minutes.
Set this value to 0 if you don't want to cache results.
Data Set Key
If your data set isn't in the top-level of your API response you can define it's location using dot syntax.
So if your API result looks like:
You would set the data set key value to:
Item Key
Define the unique identifier to be used as the option value.
So if the iteration in your API result looks like this:
You might set your item key to:
Item Label
Define the value to be used as the option label.
So if the iteration in your API result looks like this:
You might set your item label to:
Using the API Select value in your templates
Let's assume your API select field handle is api_select_users
API response is like so: