sebdesign/artisan-cloudflare
Composer 安装命令:
composer require sebdesign/artisan-cloudflare
包简介
Laravel artisan commands for Cloudflare
关键字:
README 文档
README
Laravel artisan commands for interacting with the CloudFlare API.
Installation
You can install the package via composer. This package requires Laravel 6.0 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, add the service provider in config/app.php.
<?php 'providers' => [ Sebdesign\ArtisanCloudflare\ServiceProvider::class, ],
Configuration
Publish the config file in config/cloudflare.php.
To authenticate with an API key set CLOUDFLARE_KEY and CLOUDFLARE_EMAIL in the .env.
Otherwise you can use an API token by setting the CLOUDFLARE_TOKEN in the .env.
php artisan vendor:publish --provider="Sebdesign\ArtisanCloudflare\ServiceProvider"
The following options are available:
<?php return [ /** * API token generated from the User Profile 'My Profile > Api Tokens > API Tokens' page. * create token > Edit zone DNS > "Permissions" Zone:Cache Purge:Purge */ 'token' => env('CLOUDFLARE_TOKEN'), /** * Global API Key on the "My Profile > Api Tokens > API Keys" 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. * * you can find your zoneId under 'Account Home > site > Api'. * * E.g. * * '023e105f4ecef8ad9ca31a8372d0c353' => [ * 'files' => [ * 'http://example.com/css/app.css', * ], * 'tags' => [ * 'styles', * 'scripts', * ], * 'hosts' => [ * 'www.example.com', * 'images.example.com', * ], * ], */ 'zones' => [ // ], ];
Usage
Purge command
Read more about Purging cached resources from Cloudflare on the support article.
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.
Purging tags is available for Enterprise accounts only.
php artisan cloudflare:cache:purge --tag=styles --tag=scripts
Purge individual hosts from all the zones.
Purging hosts is available for Enterprise accounts only.
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
Block IP command
Block an IP address for all the zones.
php artisan cloudflare:waf:block-ip 6.6.6.6
Block an IP address for a specific zone.
php artisan cloudflare:waf:block-ip 6.6.6.6 023e105f4ecef8ad9ca31a8372d0c353
Block an IP address for all the zones with a custom comment.
php artisan cloudflare:waf:block-ip 6.6.6.6 --notes="By Artisan Cloudflare"
Block an IP address for a specific zone with a custom comment.
php artisan cloudflare:waf:block-ip 6.6.6.6 023e105f4ecef8ad9ca31a8372d0c353 --notes="By Artisan Cloudflare"
Changelog
Please see CHANGELOG for more information on what has changed recently.
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email info@sebdesign.eu instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
sebdesign/artisan-cloudflare 适用场景与选型建议
sebdesign/artisan-cloudflare 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 288k 次下载、GitHub Stars 达 77, 最近一次更新时间为 2016 年 11 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「laravel」 「cloudflare」 「artisan」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sebdesign/artisan-cloudflare 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sebdesign/artisan-cloudflare 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sebdesign/artisan-cloudflare 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Symfony bundle for Cloudflare integration: trusted proxies, real client IP detection, forwarded headers.
A PSR-7 compatible library for making CRUD API endpoints
Cloudflare Middleware For Guzzle
Library for helping bypass the Cloudflare IUAM page
A ZF2 plugin to fix global variables when using CloudFlare
Boost the performance of your site with Cloudflare or Varnish.
统计信息
- 总下载量: 288k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 77
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-19