PHP code example of kiefernwald / affair

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

    

kiefernwald / affair example snippets




use Carbon\Carbon;
use Kiefernwald\Affair\Model\Event;
use Kiefernwald\Affair\Model\EventPlace;
use Kiefernwald\Affair\Services\AffairInterface;
use Kiefernwald\Affair\Services\EventProviderInterface;

class MyEventProvider implements EventProviderInterface {

    public function provideSingle(string $eventId): Event
    {
        // ...
    }

    public function provideMany(
        Carbon $start,
        Carbon $end,
        ?EventPlace $place = null,
        int $maxResults = AffairInterface::MAX_EVENTS
    ): array
    {
        // ...
    }

    public function storeEvent(Event $event)
    {
        // ...
    }
}

    // ...

    $affair = new Affair(new MyEventProvider());

    // ...