1. Go to this page and download the library: Download glhd/linearavel 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/ */
glhd / linearavel example snippets
use Glhd\Linearavel\Facades\Linear;
$viewer = Linear::viewer() // "viewer" is the name of the GraphQL query
->with('organization', 'id', 'name') // `with` lets you quickly retrieve nested fields
->get('id', 'name', 'active', 'avatarUrl', 'timezone'); // `get` defines the fields to retrieve
use Glhd\Linearavel\Data\Enums\PaginationOrderBy;
use Glhd\Linearavel\Requests\Inputs\DateComparatorInput;
use Glhd\Linearavel\Requests\Inputs\IssueFilterInput;
$issues = linear()
->issues(
filter: new IssueFilterInput(
createdAt: new DateComparatorInput(gt: now()->subWeek()),
),
orderBy: PaginationOrderBy::updatedAt,
first: 50,
)
->get();
use Glhd\Linearavel\Exceptions\LinearRequestException;
try {
linear()->issue($id)->get();
} catch (LinearRequestException $exception) {
$exception->messages(); // Collection of human-readable messages
$exception->codes(); // Collection of Linear error codes, e.g. "RATELIMITED"
$exception->errors(); // The raw GraphQL errors
$exception->getResponse(); // The Saloon response
}
use Glhd\Linearavel\Data\Contracts\OrganizationInviteDetailsPayload;
use Glhd\Linearavel\Data\OrganizationInviteFullDetailsPayload;
$details = linear()->organizationInviteDetails($id)->get();
assert($details instanceof OrganizationInviteDetailsPayload);
if ($details instanceof OrganizationInviteFullDetailsPayload) {
echo $details->organizationName;
}