laravel-strapi
laravel-strapi copied to clipboard
[BREAKING] Code refactoring
DONE
- dropped support for Laravel <= 8
- dropped support for PHP <= 8.1 (Laravel ^9 || ^10 already supports PHP 8.2 https://endoflife.date/laravel)
- updated all composer packages
- added shared method
getResponse() - fixed
$responsereturned byCache::remember()https://stackoverflow.com/a/74783008/3929620 - used closure in
$response->throw() - revised esceptions classes, now extend
Illuminate\Http\Client\RequestException - used
Http::withToken()instead ofHttp::withHeaders() - used
Http::withQueryParameters()instead ofhttp_build_query() - added
Http::withOptions()andHttp::baseUrl() - renamed parameter
$typeto$name, as it is more consistent with the field used by Strapi - renamed
$queryDatato$queryParams, as it is more consistent withHttp::withQueryParameters() - removed almost all parameters (e.g.
$sortKey,$sortOrder,$populate, etc.) in favor of$queryParams, which allows greater control over the API parameters used - now
$queryParamsalso allows you to use pagination by offset values (pagination[start]andpagination[limit]), which previously conflicted with pagination by page values (pagination[page]andpagination[limit]) set directly within the methodcollection() - added optional
$cacheTimeparameter to override the global value defined inSTRAPI_CACHE_TIMEper-call - removed the
collectionCount()method, as the/api/$name/countentrypoint does not seem to exist anymore in Strapi v4 (?), and also thepagination[withCount]parameter exists and it's active by default - removed the
entriesByField()method as it is superfluous, because it is possible to make the same call with thecollection()method (see examples inREADME) - moved option
STRAPI_FULL_URLSglobally in.envfile - removed
$pluckparameter as it is superfluous to the primary functionality of this package: everyone is free to alter the response as they wish - incremented
config('strapi.pagination.limit')from 20 to 25 (default Strapipagination[pageSize]) - revised the entire
READMEfile
TODO
- update references in Strapi documentation https://github.com/strapi/documentation/blob/main/docusaurus/docs/dev-docs/integrations/laravel.md
- might it be a good idea to add a F.A.Q. or Known issues section on the
README? this could be included in this section, useful for those who have a local development setup (e.g. mkcert):
# .env.local
HTTP_CLIENT_VERIFY_SSL=false
// config/http.php
return [
'client' => [
'verify_ssl' => (bool) env('HTTP_CLIENT_VERIFY_SSL', true),
],
];
// app/Providers/AppServiceProvider.php
use Illuminate\Support\Facades\Http;
public function boot(): void
{
Http::globalOptions([
'verify' => config('http.client.verify_ssl'),
]);
}
Hi @dbfx, is there any problem accepting this pull request?