PHP code example of sharpapi / laravel-skills-database-api
1. Go to this page and download the library: Download sharpapi/laravel-skills-database-api 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/ */
sharpapi / laravel-skills-database-api example snippets
namespace App\Http\Controllers;
use GuzzleHttp\Exception\GuzzleException;
use SharpAPI\SkillsDatabaseApi\SkillsDatabaseApiService;
class SkillsController extends Controller
{
protected SkillsDatabaseApiService $skillsService;
public function __construct(SkillsDatabaseApiService $skillsService)
{
$this->skillsService = $skillsService;
}
/**
* @throws GuzzleException
*/
public function searchSkills(string $query)
{
$results = $this->skillsService->searchSkills($query);
return response()->json($results);
}
/**
* @throws GuzzleException
*/
public function getSkillDetails(string $skillId)
{
$skill = $this->skillsService->getSkillById($skillId);
return response()->json($skill);
}
}