Skip to content

5.0.0

Latest

Choose a tag to compare

@github-actions github-actions released this 12 Nov 13:14
· 0 commits to 4.x since this release
5f105bb

Added

  • Added a publishable example config file (php artisan vendor:publish --tag=element-api).
  • Endpoint functions can now return a Laravel API resource (or any Responsable), and transformer can be set to a Laravel API resource class.
  • Endpoints can now be the name of an invokable class, so the config file can be cached with php artisan config:cache.

Changed

  • Element API now requires Craft 6 and PHP 8.5, and no longer uses the Yii 2 adapter.
  • The plugin was ported to Craft 6’s Laravel-based architecture, and its classes moved to the CraftCms\ElementApi namespace. See the upgrade guide for the full list.
  • The config file moved from config/element-api.php to config/craft/element-api.php.
  • Endpoints are registered as Laravel routes, and can use Laravel route syntax (news/{entryId}.json). Craft 5 patterns such as news/<entryId:\d+>.json still work.
  • Endpoint functions can set response headers with ResponseHeaders::add(), and can type-hint services and Illuminate\Http\Request.
  • Responses no longer set cookies, and endpoints no longer start a session.

Removed

  • Removed the first endpoint setting. Use one instead.
  • Removed the beforeSendData event and craft\elementapi\DataEvent. Use the new CraftCms\ElementApi\Events\SendingData Laravel event instead.