PHP code example of vadage / oxidize

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

    

vadage / oxidize example snippets


$userResult = $this->userRpc->login($email, $password);
if ($userResult->isOk()) {
    $user = $userResult->unwrap();
    $this->messages->queue(sprintf('Hello %1$s.', $user->getUsername()));
}

$terminationDateOption = $user->getTerminationDate();
if ($terminationDateOption->isSome()) {
    $terminationDate = $terminationDateOption->unwrap();
    $this->messages->queue(sprintf('Your login will be deactivated after %1$s.', $terminationDate->format(DateTimeInterface::RSS)));
}

$this->userRpc->login($email, $password)->andThenContinue(function (User $user) {
    $username = $user->getUsername();

    $user->getTerminationDate()
        ->andThenContinue(function (DateTime $terminationDate) {
            $formattedDate = $terminationDate->format(DateTimeInterface::RSS);
            $this->messages->queue(sprintf('Hello %1$s. Your login will be deactivated after %2$s.', $username, $formattedDate));
        })
        ->orElseContinue(function () {
            $this->messages->queue(sprintf('Hello %1$s.', $username));
        });
});