Release Notes
Support Policy
Athenaeum attempts to follow a release cycle that matches closely to that of Laravel. However, due to limited amount of project maintainers, no guarantees can be provided.
Version | PHP | Laravel | Release | Security Fixes Until |
---|---|---|---|---|
8.x | 8.2 - ? | v11.x | ~1st Quarter 2024 | TBD |
7.x * | 8.1 - 8.2 | v10.x | February 16th, 2023 | February 2024 |
6.x | 8.0 - 8.1 | v9.x | April 5th, 2022 | February 2023 |
5.x | 7.4 | v8.x | October 4th, 2020 | N/A |
< 5.x | - | - | See CHANGELOG.md | N/A |
*: current supported version.
TBD: "To be decided".
v7.x
Highlights
These are the highlights of the latest major version of Athenaeum.
v8.1
and Laravel v10.x
PHP PHP version v8.1
is now the minimum required version for Athenaeum. Laravel v10.x
packages are now used.
Http Conditional Requests
The ETags package has been upgraded to offer support for RFC 9110's conditional requests. The following preconditions are supported by default:
See documentation for details.
DownloadStream
Response Helper
As a part of the ETags package, a DownloadStream
response helper is now available. It is able to create streamed response for Range
requests.
use Illuminate\Support\Facades\Route;
use Aedart\ETags\Preconditions\Responses\DownloadStream;
Route::get('/downloads/{file}', function (DownloadFileRequest $request) {
return DownloadStream::for($request->resource)
->setName($request->route('file'));
});
API Requests
The Http Api package has been upgraded with a few Request abstractions. These can speed up development of API endpoints.
Example Request
use Aedart\Http\Api\Requests\Resources\ShowSingleResourceRequest;
use Illuminate\Database\Eloquent\Model;
use App\Models\User;
class ShowUser extends ShowSingleResourceRequest
{
public function findRecordOrFail(): Model
{
return User::findOrFail($this->route('id'));
}
public function mustEvaluatePreconditions(): bool
{
return true;
}
}
Example Action
Route::get('/users/{id}', function (ShowUser $request) {
return UserResource::make($request->record)
->withCache();
})->name('users.show');
Api Resource Http Caching
Additionally, Api Resources now have the ability to set Caching headers, ETag, and Last-Modified date, via a single method:
Route::get('/addresses/{id}', function ($id) {
return new AddressResource(Address::findOrFail($id))
->withCache();
});
See documentation for details.
Custom Queries for Search and Sorting Filters
The SearchFilter
and SearchProcessor
now support custom search callbacks.
use Aedart\Filters\Processors\SearchProcessor;
use Illuminate\Contracts\Database\Query\Builder;
use Illuminate\Contracts\Database\Eloquent\Builder as EloquentBuilder;
$processor = SearchProcessor::make()
->columns(function(Builder|EloquentBuilder $query, string $search) {
return $query
->orWhere($column, 'like', "{$search}%");
});
The same applies for the SortFilter
and SortingProcessor
.
use Aedart\Filters\Processors\SortingProcessor;
$processor = SortingProcessor::make()
->sortable([ 'email', 'name'])
->withSortingCallback('email', function($query, $column, $direction) {
return $query->orderBy("users.{$column}", $direction);
});
Remove Response Payload Middleware
A new middleware has been added for the Http Api package, which is able to remove a response's body, when a custom query parameter is available. See middleware documentation for details.
Attach File Stream for Http Client
The Http Client now supports uploading a file stream.
use Aedart\Streams\FileStream;
$response = $client
->attachStream('2023_annual.pdf', FileStream::open('/reports/2023_annual.pdf', 'r'))
->post('/reports/annual');
Improved Status object
The Status
object that is provided for response expectations has been improved. It now contains several helper methods for determining if it matches a desired Http status code.
use Aedart\Contracts\Http\Clients\Responses\Status;
use Teapot\StatusCode\All as StatusCode;
$client
->expect(function(Status $status){
if ($status->isBadGateway()) {
// ...
}
if ($status->is(StatusCode::UNPROCESSABLE_ENTITY)) {
// ...
}
if ($status->satisfies([ StatusCode::CREATED, StatusCode::NO_CONTENT ])) {
// ...
}
// ... etc
});
hash()
accept hashing options
Stream Streams now accept and apply hashing options in hash()
method. This was previously also supported, but required PHP v8.1
. PHP version check is no longer performed internally. See documentation for more details.
sync()
is now supported
Stream File streams can now have their content synchronised to file, via the sync()
method. See example.
to()
memory unit method
The Memory utility now offers a to()
method, which allows specifying a string unit to convert the memory unit into.
echo Memory::unit(6_270_000_000) // bytes
->to('gigabyte', 2); // 6.27
Changelog
Make sure to read the changelog for additional information about the latest release, new features, changes and bug fixes.