PHP code example of samirmhsnv / laravel-linear-log

1. Go to this page and download the library: Download samirmhsnv/laravel-linear-log 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/ */

    

samirmhsnv / laravel-linear-log example snippets


'linear' => [
    'driver' => 'linear',
    'level' => env('LINEAR_LOG_LEVEL', 'error'),
    'api_key' => env('LINEAR_API_KEY'),
    'team_id' => env('LINEAR_TEAM_ID'),
    'project_id' => env('LINEAR_PROJECT_ID'),
    'state_id' => env('LINEAR_STATE_ID'),
    'bug_label_id' => env('LINEAR_BUG_LABEL_ID'),
    'priority' => env('LINEAR_PRIORITY'),
    'title_prefix' => env('LINEAR_TITLE_PREFIX', env('APP_NAME', 'Laravel')),
    'timeout' => env('LINEAR_TIMEOUT', 3.0),
    'connect_timeout' => env('LINEAR_CONNECT_TIMEOUT', 1.5),
],

use Illuminate\Support\Facades\Log;

Log::channel('linear')->error('Payment webhook failed', [
    'order_id' => 1234,
    'provider' => 'stripe',
]);
bash
php artisan vendor:publish --tag=linear-issues-config
dotenv
LOG_STACK=single,linear
bash
php artisan tinker --execute '$apiKey = env("LINEAR_API_KEY"); $query = "query { teams { nodes { id key name } } }"; $response = Illuminate\Support\Facades\Http::withHeaders(["Authorization" => $apiKey, "Content-Type" => "application/json"])->post("https://api.linear.app/graphql", ["query" => $query]); dump($response->json());'
bash
php artisan tinker --execute '$apiKey = env("LINEAR_API_KEY"); $query = "query { projects { nodes { id name } } }"; $response = Illuminate\Support\Facades\Http::withHeaders(["Authorization" => $apiKey, "Content-Type" => "application/json"])->post("https://api.linear.app/graphql", ["query" => $query]); dump($response->json());'
bash
php artisan tinker --execute '$apiKey = env("LINEAR_API_KEY"); $teamId = env("LINEAR_TEAM_ID"); $query = "query { team(id: \"".$teamId."\") { states { nodes { id name type } } } }"; $response = Illuminate\Support\Facades\Http::withHeaders(["Authorization" => $apiKey, "Content-Type" => "application/json"])->post("https://api.linear.app/graphql", ["query" => $query]); dump($response->json());'
bash
php artisan tinker --execute '$apiKey = env("LINEAR_API_KEY"); $query = "query { issueLabels { nodes { id name } } }"; $response = Illuminate\Support\Facades\Http::withHeaders(["Authorization" => $apiKey, "Content-Type" => "application/json"])->post("https://api.linear.app/graphql", ["query" => $query]); dump($response->json());'
bash
php artisan config:clear