This package will allow you to connect your Laraval application with Linear via a Linear OAuth App.
You can install the package via composer:
composer require marshmallow/laravel-linear
After you've installed the package you can run the installation command. This command will publish the mandatory migrations and publish components and assets that are needed to show the beautifull Linear pages.
php artisan linear:install
Go to settings in you Linear account. In the account menu
, you will find the API button. Once you click on API
you will be able to create an OAuth application
. Click on Create New
.
Fill in all the field. The most importent part is the Callback URLs. You need to add you callback URL like your-domain.test/linear/oauth2/callback
. Add the callback url for all your domains. Local, Beta and Production so it will work on all your sites.
When you've create your app, you will get a Client id
and a Client secret
. Copy these, we need them later!
Using this package is super easy. We just need to make two minor updates to your application.
When you created your Linear OAuth Application you got a Client id
and a Client secret
. You need to add them to your .env
file.
LINEAR_CLIENT_ID="____YOUR_CLIENT_ID____"
LINEAR_CLIENT_SECRET="____YOUR_CLIENT_SECRET____"
First you need to be logged in to your application. This is so not everybody can change the connection to Linear.
On your Authenticatable model, usually the User model, you need to implement one new method to let the package know who can manage the Linear connection. Add the method below.
class User extends Authenticatable
{
// ...
public function allowedToManagerLinearConnection(): bool
{
return in_array($this->email, [
'stef@marshmallow.dev',
]);
}
}
Go to your-domain.test/linear/auth
and follow the steps to connect your Laraval application to Linear. After you've done this you will be able to connect a company, team and project.
use App\Models\User;
use LaravelLinear\Notifications\NewLinearIssue;
use LaravelLinear\Notifications\Messages\LinearIssue;
$issue = (new LinearIssue)
->title('Issue title')
->message('Issue message');
$user = User::first();
$user->notify(new NewLinearIssue($issue));
When you go to your-domain.test/linear/auth
after you've connected to linear you will be able to change the config.
When you install a new version of this package via Composer it might be helpfull to run the update command so all the views and assets are up to date. This command will publish the latest assets for this package and publish new components if they are available.
php artisan linear:update
Here are some documentation pages from Linear that might be helpfull.
https://developers.linear.app/docs/oauth/authentication https://developers.linear.app/docs/oauth/oauth-actor-authorization
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.