You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. # Pirectus - a small Client for Directus 9
  2. This Version is in a early Stage and only supports get, post, patch for Items. Authentification is only possible with token.
  3. It uses [https://docs.guzzlephp.org/en/stable/](https://docs.guzzlephp.org/en/stable/) and is inspired by the [https://docs.directus.io/reference/sdk/](https://docs.directus.io/reference/sdk/)
  4. Pirectus is used in [https://github.com/tentakelfabrik/super-gear-directus](https://github.com/tentakelfabrik/super-gear-directus), a small CMS.
  5. ## Installation
  6. ```php
  7. composer require tentakelfabrik/pirectus
  8. ```
  9. ## Quickstart
  10. ```php
  11. require('vendor/autoload.php');
  12. use Pirectus\Pirectus;
  13. use Pirectus\Auth\TokenAuth;
  14. $pirectus = new Pirectus('<directus-url>', [
  15. 'auth' => new TokenAuth('<directus-authtoken>')
  16. ]);
  17. ```
  18. ```php
  19. $results = $pirectus
  20. ->items('pages')
  21. ->fields(['id', 'title', 'content'])
  22. ->filter([
  23. 'status' => ['_eq' => 'published']
  24. ])
  25. ->find();
  26. ```
  27. ## ItemsQueryBuilder
  28. ### fields(array $fields)
  29. ### addFields(array $fields)
  30. ### filter(array $filter)
  31. ### addFilter(array $filter)
  32. ### limit(int $value)
  33. ### offset(int $value)
  34. ### groupBy(array $groupBy)
  35. ### addGroupBy(string $field)
  36. ### aggregate(string $aggregate, string $field)
  37. ### sort(array $sort)
  38. ### addSort(array $sort)
  39. ### search(string $value)
  40. ### meta(string $value)
  41. ### aliases(string $field, string $alias)