Download the PHP package offline/laravel-local-cache without Composer

On this page you can find all versions of the php package offline/laravel-local-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-local-cache

Local File Cache for Laravel 5

Build Status

This package allows you to cache remote files in the local filesystem. This is useful if you try to reduce bandwidth consumption when requesting files from services like Amazon S3.

The implementation also enables you to serve files from cache that may not be available at their remote location at times.

Install it

To install this package include it in your composer.json and run composer update:

"require": {
   "offline/laravel-local-cache": "~1.0"
}

Add the Service Provider to the provider array in your config/app.php

'Offline\LocalCache\LocalCacheServiceProvider'

Add an alias for the facade to your config/app.php

'LocalCache' => 'Offline\LocalCache\Facades\LocalCache',

Publish the config:

$ php artisan vendor:publish --provider="Offline\LocalCache\LocalCacheServiceProvider"

Create the directory storage/localcache (edit the storage_path setting in config/localcache.php to change this location).

Use it

To cache a file use the getCachedHtml method. The file will be downloaded and stored to disk. The method returns the local URL for your file.

By default, a /cache/{hash} route is generated which serves the file's contents with the correct mime type. To change the route, edit the route setting in config/localcache.php.

The getCachedHtml method works with any string that contains any number of URLs. It extracts and replaces the links accordingly.

To prevent URLs from being cached, prefix them with a @ symbol:

Example Middleware

This example middleware caches all external files referenced in your template and replaces the URLs.

<?php

namespace App\Http\Middleware;

use Closure;
use Offline\LocalCache\Facades\LocalCache;

class LocalCacheMiddleware
{

    /**
     * Cache and replace links to external assets.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure                 $next
     *
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $response = $next($request);

        $response->setContent(
            LocalCache::getCachedHtml($response->getContent())
        );

        return $response;
    }

}

Add it to your app/Http/Kernel.php

/**
 * The application's route middleware.
 *
 * @var array
 */
protected $routeMiddleware = [
    'localcache'   => \App\Http\Middleware\LocalCacheMiddleware::class,
];

And use it in your routes.php or controller.

Route::get('/', [
    'uses'       => 'PageController@index',
    'middleware' => ['localcache']
]);

All versions of laravel-local-cache with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version ~5.0
ext-curl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package offline/laravel-local-cache contains the following files

Loading the files please wait ....