PHP code example of juststeveking / resume-php

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

    

juststeveking / resume-php example snippets


use JustSteveKing\Resume\Builders\ResumeBuilder;
use JustSteveKing\Resume\DataObjects\Basics;
use JustSteveKing\Resume\DataObjects\Location;
use JustSteveKing\Resume\DataObjects\Profile;
use JustSteveKing\Resume\Enums\Network;
use JustSteveKing\Resume\ValueObjects\Email;
use JustSteveKing\Resume\ValueObjects\Url;

// Create the basics section using Value Objects for Email and URL
$basics = new Basics(
    name: 'John Doe',
    label: 'Software Engineer',
    email: new Email('[email protected]'),
    url: new Url('https://johndoe.com'),
    summary: 'Experienced software engineer with 5+ years in web development.',
    location: new Location(
        address: '123 Main St',
        postalCode: '94105',
        city: 'San Francisco',
        countryCode: 'US',
        region: 'CA',
    ),
    profiles: [
        new Profile(Network::GitHub, 'johndoe', new Url('https://github.com/johndoe')),
        new Profile(Network::LinkedIn, 'johndoe', new Url('https://linkedin.com/in/johndoe')),
    ],
);

// Build the résumé fluently
$resume = (new ResumeBuilder())
    ->basics($basics)
    ->addWork(new \JustSteveKing\Resume\DataObjects\Work(
        name: 'Tech Corp',
        position: 'Senior Developer',
        startDate: '2020-01-01',
        summary: 'Led development of core platform features',
        highlights: ['Improved performance by 40%', 'Mentored junior developers'],
    ))
    ->build();

// Validate against the official JSON schema
$isValid = $resume->validate();

// Convert to schema-compliant JSON
$json = json_encode($resume, JSON_PRETTY_PRINT);

use JustSteveKing\Resume\Factories\ResumeFactory;

// From a JSON string
$resume = ResumeFactory::fromJson($jsonString);

// From a YAML string
$resume = ResumeFactory::fromYaml($yamlString);

// From an associative array
$resume = ResumeFactory::fromArray($data);

use JustSteveKing\Resume\DataObjects\Education;
use JustSteveKing\Resume\DataObjects\Skill;
use JustSteveKing\Resume\Enums\EducationLevel;
use JustSteveKing\Resume\Enums\SkillLevel;

$resumeBuilder = (new ResumeBuilder())->basics($basics);

$resumeBuilder->addEducation(new Education(
    institution: 'University of Technology',
    area: 'Computer Science',
    studyType: EducationLevel::Bachelor,
    startDate: '2014-09-01',
    endDate: '2018-06-01',
));

$resumeBuilder->addSkill(new Skill(
    name: 'PHP',
    level: SkillLevel::Expert,
    keywords: ['Laravel', 'Symfony', 'API Development'],
));

$resume = $resumeBuilder->build();

$jsonLd = $resume->toJsonLd();
echo json_encode($jsonLd, JSON_PRETTY_PRINT);

// Basic export (defaults to English)
echo $resume->toMarkdown();

// Custom configuration and Localization
$markdown = $resume->toMarkdown(
    options: [
        'work' => true,
        'education' => true,
    ],
    locale: 'cy' // Welsh
);

$insights = $resume->getInsights();

// Calculate total years of experience
echo $insights->getTotalYearsExperience(); // e.g., 8.5

// Identify gaps in work history (greater than 30 days)
$gaps = $insights->getWorkGaps();

// Get skill usage frequency based on mentions in work highlights
$skills = $insights->getSkillFrequency();

use JustSteveKing\Resume\Builders\JobDescriptionBuilder;

$jobDescription = (new JobDescriptionBuilder())
    ->name('Senior PHP Developer')
    ->location('Remote')
    ->description('Lead our backend transition to PHP 8.4')
    ->addHighlight('Competitive salary')
    ->addSkill('PHP')
    ->addTool('Docker')
    ->addResponsibility('Code reviews')
    ->build();
bash
composer