PHP code example of fdevs / publish-workflow

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

    

fdevs / publish-workflow example snippets




namespace App\Model;

use FDevs\PublishWorkflow\Model\PublishTrait;
use FDevs\PublishWorkflow\PublishInterface;

class SameDocument implements PublishInterface
{
    use PublishTrait;
}


$publishWorkflow = new FDevs\PublishWorkflow\PublishWorkflow();
$model = new App\Model\SameDocument();
$model->setPublishable(true);

echo $publishWorkflow->isPublish($model); //true


//start publishable tomorrow
$model
    ->setPublishable(true)
    ->setPublishStartDate(new \DateTime('tomorrow'))
;

echo $publishWorkflow->isPublish($model); //false

//end publishable tomorrow
$model
    ->setPublishable(true)
    ->setPublishEndDate(new \DateTime('tomorrow'))
;

echo $publishWorkflow->isPublish($model); //true
 bash
$ php composer.phar