1. Go to this page and download the library: Download ornament/core library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ornament / core example snippets
use Ornament\Core\Model;
class FooModel
{
use Model;
public readonly DateTime $datecreated;
}
use Ornament\Core\Model;
class FooModel
{
use Model {
Model::__construct as ornamentConstruct;
}
public function __construct(private MyDependency $foo, ?iterable $input = null)
{
$this->ornamentConstruct($input);
}
}
use Ornament\Core\{ Model, Construct };
class FooModel
{
use Model;
#[Construct(new DateTimeZone('Europe/Amsterdam'))]
public readonly DateTime $datecreated;
}
enum MyEnum
{
case foo = 1;
case bar = 2;
}
class MyModel
{
public MyEnum $baz;
}
// Fails: 3 is not in the enum!
$model = new MyModel(['baz' => 3]);
class MyModel
{
// ...
#[\Ornament\Core\Getter("fullname")]
protected function exampleGetter() : string
{
return $this->firstname.' '.$this->lastname;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.