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 |
---|---|---|---|---|
7.x | 8.1 - 8.2 | v10.x | ~1st Quarter 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 |
4.x | 7.4 | v7.x | April 15th, 2020 | N/A |
< 4.x | - | - | See CHANGELOG.md | N/A |
*: current supported version.
TBD: "To be decided".
v6.x
Highlights
These are some the new features of Athenaeum v6.x
.
v8
and Laravel v9.x
PHP Athenaeum has been upgraded to usePHP v8.0
and Laravel v9.x
. Furthermore, PHP v8.1
is also supported.
Improved Documentation
Several improvements have been made throughout the documentation. From version 6.x
, a Security Policy, Code of Conduct and an improved Contribution Guide is made available.
Union Types support in DTO
The Dto
and ArrayDto
now support union types for their properties. When populating a DTO, the most suitable match will bre chosen.
class Person extends ArrayDto
{
protected array $allowed = [
'name' => 'string|null',
];
}
class Organisation extends Dto
{
protected array $allowed = [
'name' => 'string|null',
'slogan' => 'string|null',
];
}
class Record extends Dto
{
protected array $allowed = [
'reference' => ['string', Person::class, Organisation::class, 'null'],
];
}
// ------------------------------------------------------------------------ //
// Reference is a string...
$record->populate([
'reference' => 'https:://google.com'
]);
echo gettype($record->reference); // string
// Reference becomes a Person...
$record->populate([
'reference' => [ 'name' => 'Jane Jensen' ]
]);
echo ($record->reference instanceof Person); // true
// Reference becomes an Organisation...
$record->populate([
'reference' => [ 'name' => 'Acme', 'slogan' => 'Building stuff...' ]
]);
echo ($record->reference instanceof Organisation); // true
See Union Type Handling documentation for additional examples.
Streams
A package that offers an extended version of PSR-7's defined StreamInterface
; a wrapper for common stream operations, mostly intended for file streams.
use Aedart\Streams\FileStream;
$stream = FileStream::open('my-file.txt')
->put('Hi there');
$more = FileStream::openMemory()
->put("\nMore things to show...")
->positionToStart();
$stream
->append($more);
echo (string) $stream; // Hi there
// More things to show...
MIME-types detection
The MIME-types packages offers a way to detect a file's MIME-type based on a small sample of its contents.
use Aedart\MimeTypes\Detector;
$file = fopen('my-picture.jpg', 'rb');
$mimeType = (new Detector())->detect($file);
Maintenance Modes
A new Maintenance Modes package has been added, which offers a few additional drivers that can be used for storing application down state.
Where not in slug...
The \Aedart\Database\Models\Concerns\Slugs
concern now offers a whereSlugNotIn()
query scope method.
// ...inside your Eloquent model
$result = $query
->whereSlugNotIn(['alpha', 'beta', 'gamma'])
->get();
Validate JSON
The Json
utility has been given a new method, which can be used to determine if a value is a valid JSON encoded string.
use Aedart\Utils\Json;
echo Json::isValid('{ "name": "Sven" }'); // true
Memory Util
A new Memory
util component has been added. It offers a few methods to help you deal with conversion and formatting.
use Aedart\Utils\Memory;
$unit = Memory::from('3 MB');
echo $unit->toKibibyte(); // 2929.7
// ...or create from bytes...
echo Memory::unit(482504)->legacyFormat(); // 471.2 kB
See component documentation for more examples.
Purpose change of Core Application
Perhaps a less important highlight, but still worth mentioning, is that the purpose of the Core Application package has changed from Athenaeum v6.x
. The Core Application package was originally developed to act as a "bridge" for integrating Laravel components and services into legacy applications. This is no longer the case. Version 6.x
requires a minimum of PHP v8.0
and it does not feel right to presume that the Core Application can be used as originally intended (see original motivation in version v4.x
).
From version 6.x
, the Core Application is intended for the following purposes:
- Testing
- Tinkering
- Development of non-essential standalone applications
If you are using the Core Application, for its original intent, then you are strongly encouraged to consider redesigning your application, e.g. rewrite your application using Laravel or other appropriate framework.
Changelog
Make sure to read the changelog for additional information about the latest release, new features, changes and bug fixes.