1. Go to this page and download the library: Download askancy/howlongtobeat 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/ */
askancy / howlongtobeat example snippets
use Askancy\HowLongToBeat\HowLongToBeat;
$hl2b = new HowLongToBeat();
$results = $hl2b->search('Lego');
$hl2b->search('Lego', 2);
$details = $hl2b->get(5265);
use Askancy\HowLongToBeat\HowLongToBeat;
class GameController extends Controller
{
public function search(Request $request)
{
$query = $request->input('title');
$hl2b = new HowLongToBeat();
$results = $hl2b->search($query);
return view('games.results', ['results' => $results]);
}
public function show($id)
{
$hl2b = new HowLongToBeat();
$game = $hl2b->get($id);
return view('games.show', ['game' => $game]);
}
}