PHP code example of laraiba / resource

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

    

laraiba / resource example snippets




$serviceContainer = \Laraiba\Resource\Setup\DefaultService::getServiceContainer();
$ayatRepository   = $serviceContainer->get('laraiba.ayat_repository');

$ayat = $ayatRepository->findOneById('1:7');

echo $ayat->getText();



$serviceContainer = \Laraiba\Resource\Setup\DefaultService::getServiceContainer();
$suratRepository  = $serviceContainer->get('laraiba.surat_repository');

$surat = $suratRepository->findOneBySuratNumber(114);

foreach ($surat->getAyatList() as $ayat) {
    echo $ayat->getAyatNumber() . ') ' . $ayat->getText() . "\n";
}



$serviceContainer = \Laraiba\Resource\Setup\DefaultService::getServiceContainer();
$suratRepository  = $serviceContainer->get('laraiba.surat_repository');

$surat = $suratRepository->findOneBySuratNumber(1);

$translationManager = $serviceContainer->get('laraiba.translation_manager');
$translationManager->addTranslation(new \Laraiba\Translation\Bahasa\IndonesianMinistryTranslation());

foreach ($surat->getAyatList() as $ayat) {
    echo $ayat->getAyatNumber() . ') ' . $ayat->getText() . "\n";

    $translatedAyat = $translationManager->translate($ayat);
    echo $translatedAyat->getAyatNumber() . ') ' . $translatedAyat->getText() . "\n";
}



$serviceContainer    = \Laraiba\Resource\Setup\DefaultService::getServiceContainer();

$ayatRepository      = $serviceContainer->get('laraiba.ayat_repository');
$suratRepository     = $serviceContainer->get('laraiba.surat_repository');
$translationManager  = $serviceContainer->get('laraiba.translation_manager');
sh
php composer.phar