devforislam/quran-api

Api to access the holy Quran's Ayah

dev-master 2020-01-15 08:42 UTC

This package is auto-updated.

Last update: 2024-11-15 20:42:14 UTC


README

Install package

Install devforislam/quran-api via Composer package manager:

composer require devforislam/quran-api

Add DevForIslam\QuranApi\Supports\Favoritable trait to App\User model:

<?php

namespace App;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use DevForIslam\QuranApi\Supports\Favoritable;

class User extends Authenticatable
{
    use Favoritable, Notifiable;
}

Migrate the migrations

php artisan migrate

Quran Database

Download the quran-database and import to your database.

Install Passport

We used laravel/passport for api authentication. You can install Passport via the Composer package manager:

composer require laravel/passport

Migrate passport migrations:

php artisan migrate

Install passport:

php artisan passport:install

Add the Laravel\Passport\HasApiTokens trait to your App\User model.

<?php

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Passport\HasApiTokens;

class User extends Authenticatable
{
    use HasApiTokens, Favoritable, Notifiable;
}

Now set passport as authentication driver in config/auth.php

'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],

    'api' => [
        'driver' => 'passport',
        'provider' => 'users',
    ],
],

Download API Collection

Download the post api-collection. Now, set the url and token as postman environment variable. The value of token will be user's access_token. To see th API documentation click here.

You are most welcome to contribute in this project or You have any suggestion email me to devforislam@gmail.com or mahbub.rucse@gmail.com.