PHP code example of usmanahmedmalik / inspiring-quran
1. Go to this page and download the library: Download usmanahmedmalik/inspiring-quran 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/ */
usmanahmedmalik / inspiring-quran example snippets
use Usmanahmedmalik\InspiringQuran\InspiringQuran;
$ayat = InspiringQuran::quote();
echo $ayat['arabic'];
// فَإِنَّ مَعَ ٱلْعُسْرِ يُسْرًا إِنَّ مَعَ ٱلْعُسْرِ يُسْرًا
echo $ayat['translations']['en'];
// For indeed, with hardship comes ease...
echo $ayat['reference']['surah'];
// Ash-Sharh
echo $ayat['reference']['ayah'];
// 94:5-6
use Usmanahmedmalik\InspiringQuran\InspiringQuran;
$inspiringQuran = new InspiringQuran();
// Get a random quote
$ayat = $inspiringQuran->getQuote('en');
// Get ayat by theme
$ayat = $inspiringQuran->byTheme('hope', 'en');
// Get all ayats from a theme
$hopeAyats = $inspiringQuran->getAllByTheme('hope');
// Get available themes
$themes = $inspiringQuran->getAvailableThemes();
// ['hope', 'mercy', 'patience', 'prayer', 'gratitude', ...]
// Get themes with descriptions
$themesWithDesc = $inspiringQuran->getThemesWithDescriptions();
// ['hope' => 'Verses about hope and ease in difficulty', ...]
// Get all available locales
$locales = $inspiringQuran->getAvailableLocales();
// ['en', 'nl', 'fr', 'tr', 'ur', 'de', 'es']
// Get total count of ayats
$count = $inspiringQuran->count();
// 75
// Get all ayats
$allAyats = $inspiringQuran->getAllAyats();
// In your controller
use Usmanahmedmalik\InspiringQuran\InspiringQuran;
public function index()
{
$ayat = InspiringQuran::quote('en');
return view('welcome', compact('ayat'));
}
// In your AppServiceProvider or any controller
use Illuminate\Support\Facades\View;
use Usmanahmedmalik\InspiringQuran\InspiringQuran;
public function boot()
{
View::composer('*', function ($view) {
$view->with('dailyAyat', InspiringQuran::quote());
});
}
[
'arabic' => 'فَإِنَّ مَعَ ٱلْعُسْرِ يُسْرًا',
'translations' => [
'en' => 'For indeed, with hardship comes ease.',
'ur' => 'بیشک تنگی کے ساتھ آسانی ہے',
'fr' => 'Mais, avec la difficulté vient la facilité',
'tr' => 'Çünkü zorlukla beraber kolaylık vardır',
'de' => 'Doch wahrlich, mit der Erschwernis geht Erleichterung einher',
'es' => 'Ciertamente junto a la dificultad hay facilidad',
'nl' => 'Voorwaar, met moeite komt gemak',
],
'reference' => [
'surah' => 'Ash-Sharh',
'ayah' => '94:5-6',
],
]