PHP code example of sharpapi / laravel-hr-related-skills

1. Go to this page and download the library: Download sharpapi/laravel-hr-related-skills 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-hr-related-skills example snippets




namespace App\Http\Controllers;

use GuzzleHttp\Exception\GuzzleException;
use SharpAPI\HrRelatedSkills\HrRelatedSkillsService;

class SkillsController extends Controller
{
    protected HrRelatedSkillsService $relatedSkillsService;

    public function __construct(HrRelatedSkillsService $relatedSkillsService)
    {
        $this->relatedSkillsService = $relatedSkillsService;
    }

    /**
     * @throws GuzzleException
     */
    public function getRelatedSkills(string $skillName)
    {
        $statusUrl = $this->relatedSkillsService->relatedSkills(
            $skillName,
            'English',   // optional language
            10   // optional maximum quantity
        );
        
        $result = $this->relatedSkillsService->fetchResults($statusUrl);

        return response()->json($result->getResultJson());
    }
}

use GuzzleHttp\Exception\ClientException;

try {
    $statusUrl = $this->relatedSkillsService->relatedSkills('PHP', 'English', 10);
} catch (ClientException $e) {
    echo $e->getMessage();
}
bash
php artisan vendor:publish --tag=sharpapi-hr-related-skills