Download the PHP package alantiller/directus-php-sdk without Composer

On this page you can find all versions of the php package alantiller/directus-php-sdk. 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 directus-php-sdk

Directus PHP SDK

The PHP SDK for Directus 9 (@directus/directus)

Documentation

Installation (Composer)

We're now on packagist!!! Making installation even easier, all you have to do is include our package alantiller/directus-php-sdk in your composer.json file ^1.0 for the version and then run composer update.

Or you can run composer require alantiller/directus-php-sdk and that will do all of the above for you :)

Installation (Manual)

To install the Directus PHP SDK is super simple and easy. All you need to do is download the latest release from the releases page and place the PHP file in your

Usage

We've simplified the way you create a newinstance of the SDK, now you set the config settings in the construct rather than another function. You can still define the other variables as before in the construct as below.

Personally I perfer to set the namespace when creating a new instance as I think it is cleaner but it's down to personal preference.

Config Options

Setting the options

There are currently four config options a user can set, these need to be set in the order below. Options with a start by the title are required the rest are optional.

Option 1* | Set API URL

You set the root URL to your directus installation, this field is required for the SDK to work.

Option 2* | Set Auth Prefix

You set the auth prefix for your directus instance, this is so the SDK can differentiate between two instances running in parallel

Option 3 | Set Auth Storage

The default is currently _SESSION but can be changed the the following options to fit the end users needs.

_SESSION - This stores the three Auth variables in a PHP Session on the server-side this is the most secure method but requires you to define a session session_start();

_COOKIE - This stores the three Auth variables in Cookies on the client-side but will still store and use PHP Session on the server-side due to limitations in PHP Cookie support. This can be useful if you need to retreve the access token from JS using cookies.

Option 4 | Set Auth Domain

This one is only used if option 2 has been set to _COOKIE. This sets the root auth domain of the cookie. By default it is / so it applies to the whole site but can be set to a folder if you only want the user to be authenticated in the subdirectory.

Option 5 | Set Strip Headers

This option is mainly for development which is why it has been put at the end but the request passed back to the user can contain the headers as well as the content in the array. The default value is true but can be set to false if you need access to the headers of the request.

Global

Getting the API URL

Items

Create a Single Item

Read All Items

Read By Query

Read By Primary Key

Update Single Item

Delete an Item(s)

Auth

Get / Set Token

Setting a static auth token, if someone authenticates their authentication will override this auth token!

Login

When you submit a login request it will either respone with en error "errors" or it will just return true. If it has returned try then the login was successful and the Auth has been stored using the method defined in the config (_SESSION by default). The login with AutoRefresh so you will not need to worry about the token expiring.

Refresh

By default the SDK will auto refresh every fifteen minuites so the token is never expired. We will add the ability to turn off autoRefresh in the future.

Logout

Request a Password Reset

The second value is optional if you want to sent a custom return URL for the reset email.

Reset a Password

Note: the token passed in the first parameter is sent in an email to the user when using auth_password_request


All versions of directus-php-sdk with dependencies

PHP Build Version
Package Version
Requires ext-curl Version *
php Version ^7.0 || ^8.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 alantiller/directus-php-sdk contains the following files

Loading the files please wait ....