1. Go to this page and download the library: Download oihana/php-schema 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/ */
oihana / php-schema example snippets
use org\schema\Person;
use org\schema\PostalAddress;
use org\schema\constants\Schema;
$person = new Person
([
Schema::ID => '2555',
Schema::NAME => 'John Doe',
Schema::ADDRESS => new PostalAddress
([
Schema::STREET_ADDRESS => '2 chemin des Vergers',
Schema::POSTAL_CODE => '49170'
])
]);
echo json_encode( $person , JSON_PRETTY_PRINT ) ;
use org\schema\CreativeWork;
use org\schema\Person;
use org\schema\Organization;
use org\schema\constants\Schema;
$post = new CreativeWork
([
Schema::NAME => 'Release Notes',
Schema::PUBLISHER => new Organization([ Schema::NAME => 'Oihana' ])
]);
use org\schema\Thing;
use org\schema\constants\Schema;
$parent = new Thing
([
Schema::NAME => 'Bundle',
Schema::HAS_PART =>
[
new Thing([ Schema::NAME => 'Part A' ]),
new Thing([ Schema::NAME => 'Part B' ]),
],
]);
use org\schema\Thing;
$edge = new Thing
([
'_from' => 'users/2555',
'_to' => 'groups/42',
]);
namespace app\domain;
use org\schema\Thing;
class CustomAsset extends Thing
{
public ?string $slug;
public ?string $category;
}
bash
composer
bash
composer test ./tests/org/schema/ThingTest.php
composer test ./tests/xyz/oihana/schema/PaginationTest.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.