Package Data | |
---|---|
Maintainer Username: | sebdesign |
Maintainer Contact: | info@sebdesign.eu (Sébastien Nikolaou) |
Package Create Date: | 2016-11-19 |
Package Last Update: | 2024-04-10 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-19 03:18:31 |
Package Statistics | |
---|---|
Total Downloads: | 195,235 |
Monthly Downloads: | 4,819 |
Daily Downloads: | 143 |
Total Stars: | 77 |
Total Watchers: | 5 |
Total Forks: | 7 |
Total Open Issues: | 2 |
Laravel artisan commands for interacting with the CloudFlare API.
You can install the package via composer. This package requires Laravel 5.1 or higher.
composer require sebdesign/artisan-cloudflare
Since version 5.5, Laravel uses package auto-discovery, so doesn't require you to manually add the ServiceProvider. If you don't use auto-discovery or you are using an older version, add the service provider in config/app.php
.
<?php
'providers' => [
Sebdesign\ArtisanCloudflare\ServiceProvider::class,
],
Publish the config file in config/cloudflare.php
and set your CLOUDFLARE_KEY
and CLOUDFLARE_EMAIL
in the .env
.
php artisan vendor:publish --provider="Sebdesign\ArtisanCloudflare\ServiceProvider"
The following options are available:
<?php
return [
/**
* API key generated on the "My Account" page.
*/
'key' => env('CLOUDFLARE_KEY'),
/**
* Email address associated with your account.
*/
'email' => env('CLOUDFLARE_EMAIL'),
/**
* Array of zones.
*
* Each zone must have its identifier as a key. The value is an
* associated array with *optional* arrays of files and/or tags.
* If nothing is provided, then everything will be purged.
*
* E.g.
*
* '023e105f4ecef8ad9ca31a8372d0c353' => [
* 'files' => [
* 'http://example.com/css/app.css',
* ],
* 'tags' => [
* 'styles',
* 'scripts',
* ],
* 'hosts' => [
* 'www.example.com',
* 'images.example.com',
* ],
* ],
*/
'zones' => [
//
],
];
Execute the cloudflare:cache:purge
command in your console or integrate it in your deployment workflow.
Purge all the zones with their files and tags.
php artisan cloudflare:cache:purge
Purge a single zone. If the zone exists in the config, then its files and tags will be purged. Otherwise everything will be purged from the given zone.
php artisan cloudflare:cache:purge 023e105f4ecef8ad9ca31a8372d0c353
Purge individual files from all the zones.
php artisan cloudflare:cache:purge --file="http://example.com/css/app.css" --file="http://example.com/img/logo.svg"
Purge individual tags from all the zones.
php artisan cloudflare:cache:purge --tag=styles --tag=scripts
Purge individual hosts from all the zones.
php artisan cloudflare:cache:purge --host=www.example.com --host=images.example.com
Purge individual files, tags, and hosts from all the zones.
php artisan cloudflare:cache:purge --file="http://example.com/css/app.css" --tag=scripts --tag=images --host=www.example.com
Purge individual files, tags, and hosts from a single zone.
php artisan cloudflare:cache:purge 023e105f4ecef8ad9ca31a8372d0c353 --file="http://example.com/css/app.css" --tag=scripts --tag=images --host=www.example.com
Please see CHANGELOG for more information on what has changed recently.
composer test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email info@sebdesign.eu instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.