PHP code example of pj-holt / cv-generator

1. Go to this page and download the library: Download pj-holt/cv-generator 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/ */

    

pj-holt / cv-generator example snippets




VGenerator\CVGenerator;
use CVGenerator\CVData;

// Create CV data using the fluent builder
$cvData = new CVData();
$cvData->setPersonalInfo(
    'John',
    'Doe',
    '123 Main Street, City, State 12345',
    '+1-555-123-4567',
    '[email protected]',
    'https://linkedin.com/in/johndoe', // Optional LinkedIn
    'Full Stack Developer' // Optional title
)
->setIntroduction('Experienced software developer with 5+ years in web development.')
->addExperience(
    'Tech Company',
    'Senior Developer',
    'Jan 2020',
    'Present',
    [
        'Led development of microservices architecture',
        'Implemented CI/CD pipelines',
        'Mentored junior developers',
        'Collaborated with product teams'
    ],
    [   // Detailed reference information
        'name' => 'Jane Manager',
        'job_title' => 'Engineering Director',
        'company' => 'Tech Company',
        'email' => '[email protected]',
        'phone' => '+1-555-987-6543',     // Optional
        'relationship' => 'Direct Manager' // Optional
    ]
);

// Generate PDF
$generator = new CVGenerator();
$generator->generate($cvData->toArray(), 'my_cv.pdf');

$cvData->addOptionalSection(
    'Languages',
    [
        'English (Native)',
        'Spanish (Fluent)',
        'French (Intermediate)'
    ]
);

$cvData->addOptionalSection(
    'Certifications',
    [
        'AWS Certified Solutions Architect',
        'Certified Kubernetes Administrator'
    ],
    'Professional Development' // Optional subtitle
);

$cvData->addOptionalSection(
    'Technical Skills',
    null, // No main bullets
    'Core Competencies', // Optional main subtitle
    [
        [
            'title' => 'Frontend Development',
            'subtitle' => 'Web Technologies', // Optional subsection subtitle
            'bullets' => [
                'HTML5/CSS3',
                'JavaScript/TypeScript',
                'React/Vue.js'
            ]
        ],
        [
            'title' => 'Backend Development',
            'bullets' => [
                'PHP/Laravel',
                'Node.js',
                'Python/Django'
            ]
        ]
    ]
);

$cvData->addExperience(
    'Company Name',
    'Role',
    'Start Date',
    'End Date',
    ['Achievement 1', 'Achievement 2'],
    [
        'name' => 'Reference Name',
        'job_title' => 'Job Title',
        'company' => 'Company Name',
        'email' => '[email protected]',
        'phone' => '+1-555-123-4567',     // Optional
        'relationship' => 'Direct Manager' // Optional
    ]
);

$data = [
    'first_name' => 'Jane',
    'last_name' => 'Smith',
    'address' => '456 Oak Ave, City, State',
    'telephone' => '+1-555-987-6543',
    'email' => '[email protected]',
    'linkedin' => 'https://linkedin.com/in/janesmith',
    'introduction' => 'Senior software engineer...',
    'experience' => [
        [
            'company' => 'Tech Corp',
            'role' => 'Senior Engineer',
            'date_start' => 'Jan 2020',
            'date_end' => 'Present',
            'bullets' => [
                'Led development team',
                'Implemented new features',
                'Improved performance by 40%'
            ],
            'reference' => [
                'name' => 'John Manager',
                'job_title' => 'Engineering Director',
                'company' => 'Tech Corp',
                'email' => '[email protected]',
                'phone' => '+1-555-123-4567',
                'relationship' => 'Direct Manager'
            ]
        ]
    ],
    'education' => [
        [
            'institution' => 'University',
            'qualification' => 'BS Computer Science',
            'date_start' => 'Sep 2016',
            'date_end' => 'May 2020',
            'bullets' => [
                'Graduated Magna Cum Laude',
                'Relevant coursework in algorithms',
                'Senior capstone project'
            ]
        ]
    ],
    'optional' => [
        [
            'title' => 'Technical Skills',
            'bullets' => [
                'PHP, JavaScript, Python',
                'Laravel, React, Vue.js',
                'MySQL, PostgreSQL'
            ]
        ]
    ]
];

$generator = new CVGenerator();
$generator->generate($data, 'cv.pdf');

$cvData = new CVData();
$cvData->setPersonalInfo('John', 'Doe', '123 St', '555-1234', '[email protected]')
    ->addExperience('Company A', 'Developer', 'Jan 2020', 'Dec 2021', ['Bullet 1', 'Bullet 2'])
    ->addExperience('Company B', 'Senior Developer', 'Jan 2022', 'Present', ['Bullet 3', 'Bullet 4']);

$cvData->addOptionalSection(
    'Certifications',
    [
        'AWS Certified Solutions Architect',
        'Certified Kubernetes Administrator'
    ],
    'Professional Development'
);