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.

49 lines
1.2 KiB

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 [Guzzle, PHP HTTP client](https://docs.guzzlephp.org/en/stable/) and is inspired by the [Directus JavaScript SDK](https://docs.directus.io/reference/sdk/).
  4. ## Installation
  5. ```php
  6. composer require tentakelfabrik/pirectus
  7. ```
  8. ## Quickstart
  9. ```php
  10. require('vendor/autoload.php');
  11. use Pirectus\Pirectus;
  12. use Pirectus\Auth\TokenAuth;
  13. $pirectus = new Pirectus('<directus-url>', [
  14. 'auth' => new TokenAuth('<directus-authtoken>')
  15. ]);
  16. ```
  17. ```php
  18. $results = $pirectus
  19. ->items('pages')
  20. ->fields(['id', 'title', 'content'])
  21. ->filter([
  22. 'status' => ['_eq' => 'published']
  23. ])
  24. ->find();
  25. ```
  26. ## ItemsQueryBuilder
  27. ### fields(array $fields)
  28. ### addFields(array $fields)
  29. ### filter(array $filter)
  30. ### addFilter(array $filter)
  31. ### limit(int $value)
  32. ### offset(int $value)
  33. ### groupBy(array $groupBy)
  34. ### addGroupBy(string $field)
  35. ### aggregate(string $aggregate, string $field)
  36. ### sort(array $sort)
  37. ### addSort(array $sort)
  38. ### search(string $value)
  39. ### meta(string $value)
  40. ### aliases(string $field, string $alias)