PHP code example of larva / laravel-pexels

1. Go to this page and download the library: Download larva/laravel-pexels 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/ */

    

larva / laravel-pexels example snippets


    'pexels'=>[
        'api_key'=>'abcd'
    ]

try {
	$results = \Larva\Pexels\Pexels::image()->search('abcd');
	print_r($results);
} catch (\Exception $e) {
	print_r($e->getMessage());
}

try {
	$results = \Larva\Pexels\Pexels::video()->search('abcd');
	print_r($results);
} catch (\Exception $e) {
	print_r($e->getMessage());
}

try {
	$results = \Larva\Pexels\Pexels::get('/v1/abcd');
	print_r($results);
} catch (\Exception $e) {
	print_r($e->getMessage());
}