PHP code example of symandy / resource

1. Go to this page and download the library: Download symandy/resource 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/ */

    

symandy / resource example snippets




namespace App;

use Symandy\Component\Resource\Model\ResourceInterface;
use Symandy\Component\Resource\Model\TimestampableInterface;
use Symandy\Component\Resource\Model\ToggleableInterface;

interface PostInterface extends ResourceInterface, ToggleableInterface, TimestampableInterface
{
    # Other methods
}




namespace App;

use Symandy\Component\Resource\Model\ResourceTrait;
use Symandy\Component\Resource\Model\TimestampableTrait;
use Symandy\Component\Resource\Model\ToggleableTrait;

class Post implements PostInterface
{
    use ResourceTrait, ToggleableTrait, TimestampableTrait;

    # Other attributes with getters / setters
}



use App\Post;

# ...
$post = new Post();

$id = $post->getId();
$post->enable();
$post->create();
# ...