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/ */
public function show()
{
return view('packages.show', [
'downloads' => PackagistApiServices::getPackageTotalDownloads('laravel/framework'),
]);
}
public $downloads;
public function mount()
{
$this->downloads = PackagistApiServices::getPackageTotalDownloads('laravel/framework');
}
use Illuminate\Support\Facades\Route;
use jeremykenedy\LaravelPackagist\App\Services\PackagistApiServices;
Route::get('/package-downloads', function () {
return response()->json([
'downloads' => PackagistApiServices::getPackageTotalDownloads('laravel/framework'),
]);
});