PHP code example of jeremykenedy / laravel-packagist
1. Go to this page and download the library: Download jeremykenedy/laravel-packagist 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/ */
jeremykenedy / laravel-packagist example snippets
'providers' => [
jeremykenedy\LaravelPackagist\LaravelPackagistServiceProvider::class,
];
// Vendors
PackagistApiServices::getPackagistVendorRepositoriesList('VENDOR-NAME-HERE');
PackagistApiServices::getVendorPackagesCount('VENDOR-NAME-HERE');
PackagistApiServices::getVendorsPackagesDetails('VENDOR-NAME-HERE');
PackagistApiServices::getVendorsTotalDownloads('VENDOR-NAME-HERE');
PackagistApiServices::getVendorsTotalStars('VENDOR-NAME-HERE');
// Individual Packages
PackagistApiServices::getPackageDownloads('VENDOR-NAME-HERE/PACKAGE-NAME-HERE');
PackagistApiServices::getPackageDailyDownloads('VENDOR-NAME-HERE/PACKAGE-NAME-HERE');
PackagistApiServices::getPackageMonthlyDownloads('VENDOR-NAME-HERE/PACKAGE-NAME-HERE');
PackagistApiServices::getPackageTotalDownloads('VENDOR-NAME-HERE/PACKAGE-NAME-HERE');
PackagistApiServices::getPackageTotalForks('VENDOR-NAME-HERE/PACKAGE-NAME-HERE');
PackagistApiServices::getPackageTotalOpenIssues('VENDOR-NAME-HERE/PACKAGE-NAME-HERE');
PackagistApiServices::getPackageTotalRepo('VENDOR-NAME-HERE/PACKAGE-NAME-HERE');
PackagistApiServices::getPackageTotalStars('VENDOR-NAME-HERE/PACKAGE-NAME-HERE');
PackagistApiServices::getPackageTotalWatchers('VENDOR-NAME-HERE/PACKAGE-NAME-HERE');
PackagistApiServices::getVendorsPackageDetails('VENDOR-NAME-HERE/PACKAGE-NAME-HERE');
return [
/*
|--------------------------------------------------------------------------
| Packagist Caching Settings
|--------------------------------------------------------------------------
*/
'caching' => [
'enabled' => env('PACKAGIST_CACHE_ENABLED', TRUE),
'vendorListCacheTime' => env('PACKAGIST_VENDOR_LIST_CACHE_TIME_MINUTES', 100),
'vendorItemCacheTime' => env('PACKAGIST_VENDOR_ITEM_CACHE_TIME_MINUTES', 100),
],
/*
|--------------------------------------------------------------------------
| Packagist CURL Settings
|--------------------------------------------------------------------------
*/
'curl' => [
'timeout' => env('PACKAGIST_CURL_TIMEOUT', 30),
'maxredirects' => env('PACKAGIST_CURL_MAX_REDIRECTS', 10),
],
/*
|--------------------------------------------------------------------------
| Packagist API URLS
|--------------------------------------------------------------------------
*/
'urls' => [
'vendorBase' => env('PACKAGIST_API_VENDOR_URL_BASE', 'https://packagist.org/packages/list.json?vendor='),
'projectPreFix' => env('PACKAGIST_API_VENDOR_PROJECT_BASE_PREFIX', 'https://packagist.org/packages/'),
'projectPostFix' => env('PACKAGIST_API_VENDOR_PROJECT_BASE_POSTFIX', '.json'),
],
/*
|--------------------------------------------------------------------------
| Packagist default vendor
|--------------------------------------------------------------------------
*/
'vendor' => [
'default' => env('PACKAGIST_DEFAULT_VENDOR', 'jeremykenedy'),
],
/*
|--------------------------------------------------------------------------
| Packagist logging
|--------------------------------------------------------------------------
*/
'logging' => [
'curlErrors' => env('PACKAGIST_LOG_CURL_ERROR', TRUE),
],
bash
php artisan vendor:publish --provider="jeremykenedy\LaravelPackagist\LaravelPackagistServiceProvider"
bash
php artisan vendor:publish --tag=laravelpackagist-config
php artisan vendor:publish --tag=laravelpackagist-lang
namespace App\Services\Sections;
use jeremykenedy\LaravelPackagist\App\Services\PackagistApiServices;
bash
├── .gitignore..git
├── .travis.yml
├── LICENSE
├── README.md
├── composer.json
├── phpunit.xml
└── src
├── App
│ ├── Services
│ │ └── PackagistApiServices.php
│ └── Traits
│ └── PackagistApiTrait.php
├── LaravelPackagistFacade.php
├── LaravelPackagistServiceProvider.php
├── config
│ └── laravelpackagist.php
└── resources
└── lang
└── en
└── laravelpackagist.php