graham-campbell/cloudflare

CloudFlare Provides A Simple CloudFlare Module For Laravel 5

Installs: 25

Dependents: 0

Stars: 12

Watchers: 1

Language: PHP

v0.3.0-alpha 2015-03-15 20:21 UTC

README

Laravel CloudFlare was created by, and is maintained by Graham Campbell, and provides a simple CloudFlare module for Laravel 5. It utilises a few of my packages including Laravel Core and Laravel CloudFlare API. Feel free to check out the change log, releases, license, and contribution guidelines.

Laravel CloudFlare

Build Status Coverage Status Quality Score Software License Latest Version

Installation

PHP 5.5+ or HHVM 3.3+, and Composer are required.

To get the latest version of Laravel CloudFlare, simply add the following line to the require block of your composer.json file:

"graham-campbell/cloudflare": "0.3.*"

You'll then need to run composer install or composer update to download it and have the autoloader updated.

You will need to register a few service providers before you attempt to load the Laravel CloudFlare service provider. Open up config/app.php and add the following to the providers key.

  • 'Lightgear\Asset\AssetServiceProvider'
  • 'GrahamCampbell\Core\CoreServiceProvider'
  • 'GrahamCampbell\CloudFlareAPI\CloudFlareAPIServiceProvider'

Once Laravel CloudFlare is installed, you need to register the service provider. Open up config/app.php and add the following to the providers key.

  • 'GrahamCampbell\CloudFlare\CloudFlareServiceProvider'
Looking for a laravel 4 compatable version?

Checkout the 0.2 branch, installable by requiring "graham-campbell/cloudflare": "0.2.*".

Configuration

Laravel CloudFlare supports optional configuration.

To get started, you'll need to publish all vendor assets:

$ php artisan vendor:publish

This will create a config/cloudflare.php file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

There are a few config options:

Middleware

This option ('middlware') defines the middleware to be put in front of the endpoints provided by this package. A common use will be for your own authentication middleware. The default value for this setting is [].

Connection

This option ('connection') defines the connection to use for api calls to CloudFlare. Set this to null to use the default connection, or specify a connection name as defined in your cloudflare-api config file. The default value for this setting is null.

Zone

This option ('zone') defines the zone to use for api calls to CloudFlare. The default value for this setting is 'example.com'.

Cache Driver

This option ('driver') defines the cache driver to be used. It may be the name of any driver set in config/cache.php. Setting it to null will use the driver you have set as default in config/cache.php. The default value for this setting is null.

Cache Key

This option ('key') defines the cache key to be used for storing the stats cache. The default value for this setting is 'cloudflarestats'.

Additional Configuration

You may want to check out the config for both graham-campbell/cloudflare-api and graham-campbell/core too.

Usage

Laravel CloudFlare is designed to work with Bootstrap CMS. In order for it to work in any Laravel application, you must ensure that you know how to use my Laravel Core package as configuration and knowledge of the app:install and app:update commands is required.

Laravel CloudFlare will register two routes. 'cloudflare' (cloudflare.index) should be accessed to show the CloudFlare statistics page, and 'cloudflare/data' (cloudflare.data) is internally used by this package.

License

Laravel CloudFlare is licensed under The MIT License (MIT).