PHP code example of faizshukri / phpquran

1. Go to this page and download the library: Download faizshukri/phpquran 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/ */

    

faizshukri / phpquran example snippets


FaizShukri\Quran\QuranServiceProvider::class

'Quran' => FaizShukri\Quran\Facades\Quran::class

use FaizShukri\Quran\Quran;

$quran = new Quran();

$quran->get('1:3');
// ٱلرَّحْمَٰنِ ٱلرَّحِيمِ

$quran->get('1:2,4-6');
// [
//   2 => "ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِينَ",
//   4 => "مَٰلِكِ يَوْمِ ٱلدِّينِ",
//   5 => "إِيَّاكَ نَعْبُدُ وَإِيَّاكَ نَسْتَعِينُ",
//   6 => "ٱهْدِنَا ٱلصِّرَٰطَ ٱلْمُسْتَقِيمَ"
// ]

$quran->translation('en')->get('1:3');
// The Entirely Merciful, the Especially Merciful,

$quran->translation('ar,en')->get('1:3');
// [
//   "ar" => "ٱلرَّحْمَٰنِ ٱلرَّحِيمِ",
//   "en" => "The Entirely Merciful, the Especially Merciful,"
// ]

$quran->translation('ar,en')->get('1:2,3');
// [
//   "ar" => [
//     2 => "ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِينَ",
//     3 => "ٱلرَّحْمَٰنِ ٱلرَّحِيمِ"
//   ],
//   "en" => [
//     2 => "[All] praise is [due] to Allah, Lord of the worlds -",
//     3 => "The Entirely Merciful, the Especially Merciful,"
//   ]
// ]

bash
$ php artisan vendor:publish --provider="FaizShukri\Quran\QuranServiceProvider"
bash
$ composer global