1. Go to this page and download the library: Download decodelabs/disciple 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/ */
decodelabs / disciple example snippets
namespace DecodeLabs\Disciple;
interface Adapter
{
public function isLoggedIn(): bool;
public function getIdentity(): ?string;
public function getProfile(): Profile;
public function isA(string ...$signifiers): bool;
}
use DecodeLabs\Disciple;
use My\App\DiscipleAdapter;
Disciple::setAdapter(new DiscipleAdapter(
$myUserManager
));
namespace DecodeLabs\Disciple;
interface Profile
{
public function getId(): ?string;
public function getEmail(): ?string;
public function getFullName(): ?string;
public function getFirstName(): ?string;
public function getSurname(): ?string;
public function getNickName(): ?string;
public function getRegistrationDate(): ?DateTime;
public function getLastLoginDate(): ?DateTime;
public function getLanguage(): ?string;
public function getCountry(): ?string;
public function getTimeZone(): ?string;
public function getSignifiers(): array;
}
use DecodeLabs\Disciple;
if(Disciple::isLoggedIn()) {
echo 'Hello '.Disciple::getFullName();
} else {
echo 'You should probably log in first';
}
namespace DecodeLabs\Disciple;
interface Client
{
public function getProtocol(): string;
public function getIpString(): string;
public function getAgent(): ?string;
}
if(Disciple::isA('admin')) {
echo 'You can see the fun stuff';
} else {
echo 'You should go home now';
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.