https://github.com/biigle/laravel-file-cache

Fetch and cache files from local filesystem, cloud storage or public webservers in Laravel or Lumen

https://github.com/biigle/laravel-file-cache

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.2%) to scientific vocabulary

Keywords

cache file laravel lumen
Last synced: 5 months ago · JSON representation

Repository

Fetch and cache files from local filesystem, cloud storage or public webservers in Laravel or Lumen

Basic Info
  • Host: GitHub
  • Owner: biigle
  • License: mit
  • Language: PHP
  • Default Branch: master
  • Homepage:
  • Size: 192 KB
Statistics
  • Stars: 11
  • Watchers: 3
  • Forks: 4
  • Open Issues: 0
  • Releases: 42
Topics
cache file laravel lumen
Created over 7 years ago · Last pushed 9 months ago
Metadata Files
Readme License

README.md

File Cache

Fetch and cache files from local filesystem, cloud storage or public webservers in Laravel or Lumen.

The file cache is specifically designed for use in concurrent processing with multiple parallel queue workers.

Tests

Installation

composer require biigle/laravel-file-cache

Laravel

The service provider and FileCache facade are auto-discovered by Laravel.

Lumen

Add this to bootstrap/app.php: php $app->register(Biigle\FileCache\FileCacheServiceProvider::class); $app->register(Illuminate\Filesystem\FilesystemServiceProvider::class);

To use the FileCache facade, enable $app->withFacades() and add the following to bootstrap/app.php:

php if (!class_exists(FileCache::class)) { class_alias(Biigle\FileCache\Facades\FileCache::class, 'FileCache'); }

Without facades, the file cache instance is available as app('file-cache').

Usage

Take a look at the FileCache contract to see the public API of the file cache. Example:

```php use FileCache; use Biigle\FileCache\GenericFile;

// Implements Biigle\FileCache\Contracts\File. $file = new GenericFile('https://example.com/images/image.jpg');

FileCache::get($file, function ($file, $path) { // do stuff }); ```

If the file URL specifies another protocol than http or https (e.g. mydisk://images/image.jpg), the file cache looks for the file in the appropriate storage disk configured at filesystems.disks. You can not use a local file path as URL (e.g. /vol/images/image.jpg). Instead, configure a storage disk with the local driver.

Configuration

The file cache comes with a sensible default configuration. You can override it in the file-cache namespace or with environment variables.

file-cache.maxfilesize

Default: -1 (any size) Environment: FILE_CACHE_MAX_FILE_SIZE

Maximum allowed size of a cached file in bytes. Set to -1 to allow any size.

file-cache.max_age

Default: 60 Environment: FILE_CACHE_MAX_AGE

Maximum age in minutes of a file in the cache. Older files are pruned.

file-cache.max_size

Default: 1E+9 (1 GB) Environment: FILE_CACHE_MAX_SIZE

Maximum size (soft limit) of the file cache in bytes. If the cache exceeds this size, old files are pruned.

file-cache.path

Default: 'storage/framework/cache/files'

Directory to use for the file cache.

file-cache.timeout

Default: 5.0 Environment: FILE_CACHE_TIMEOUT

Read timeout in seconds for fetching remote files. If the stream transmits no data for longer than this period (or cannot be established), caching the file fails.

file-cache.prune_interval

Default '*/5 * * * *' (every five minutes)

Interval for the scheduled task to prune the file cache.

file-cache.mime_types

Default: [] (allow all types)

Array of allowed MIME types for cached files. Caching of files with other types will fail.

Clearing

The file cache is cleared when you call php artisan cache:clear.

Testing

The FileCache facade provides a fake for easy testing. The fake does not actually fetch and store any files, but only executes the callback function with a faked file path.

```php use FileCache; use Biigle\FileCache\GenericFile;

FileCache::fake(); $file = new GenericFile('https://example.com/image.jpg'); $path = FileCache::get($file, function ($file, $path) { return $path; });

$this->assertFalse($this->app['files']->exists($path)); ```

Owner

  • Name: BIIGLE
  • Login: biigle
  • Kind: organization
  • Location: Bielefeld University

GitHub Events

Total
  • Release event: 1
  • Watch event: 1
  • Delete event: 1
  • Push event: 1
  • Pull request event: 3
  • Create event: 4
Last Year
  • Release event: 1
  • Watch event: 1
  • Delete event: 1
  • Push event: 1
  • Pull request event: 3
  • Create event: 4

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 60
  • Total Committers: 2
  • Avg Commits per committer: 30.0
  • Development Distribution Score (DDS): 0.05
Top Committers
Name Email Commits
Martin Zurowietz m****n@z****e 57
Martin Zurowietz m****r@u****m 3
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 11
  • Total pull requests: 13
  • Average time to close issues: 3 months
  • Average time to close pull requests: 28 minutes
  • Total issue authors: 5
  • Total pull request authors: 3
  • Average comments per issue: 3.0
  • Average comments per pull request: 0.08
  • Merged pull requests: 11
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: 15 minutes
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • mzur (5)
  • Ham3D (3)
  • paullaffitte (1)
  • neylsongularte (1)
  • lightsuner (1)
Pull Request Authors
  • mzur (14)
  • Jackardios (2)
  • dependabot[bot] (1)
Top Labels
Issue Labels
bug (3)
Pull Request Labels
dependencies (1)

Packages

  • Total packages: 2
  • Total downloads:
    • packagist 24,878 total
  • Total dependent packages: 6
    (may contain duplicates)
  • Total dependent repositories: 5
    (may contain duplicates)
  • Total versions: 71
  • Total maintainers: 1
packagist.org: biigle/laravel-file-cache

Fetch and cache files from local filesystem, cloud storage or public webservers in Laravel

  • License: MIT
  • Latest release: v5.1.0
    published 9 months ago
  • Versions: 42
  • Dependent Packages: 5
  • Dependent Repositories: 5
  • Downloads: 24,859 Total
Rankings
Dependent packages count: 3.1%
Average: 7.2%
Dependent repos count: 7.4%
Stargazers count: 8.0%
Forks count: 8.2%
Downloads: 9.5%
Maintainers (1)
Funding
Last synced: 6 months ago
packagist.org: biigle/laravel-image-cache

Fetch and cache files from local filesystem, cloud storage or public webservers in Laravel

  • License: MIT
  • Latest release: v3.2.3
    published about 4 years ago
  • Versions: 29
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 19 Total
Rankings
Forks count: 9.5%
Dependent packages count: 9.7%
Stargazers count: 10.0%
Average: 25.1%
Dependent repos count: 33.5%
Downloads: 63.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

composer.json packagist
  • laravel/laravel ^9.0 development
  • mockery/mockery ^1.2 development
  • phpunit/phpunit ^9.0 development
  • illuminate/console ^9.0
  • illuminate/filesystem ^9.0
  • illuminate/support ^9.0
  • symfony/finder ^6.0
.github/workflows/tests.yml actions
  • actions/checkout v3 composite
  • shivammathur/setup-php v2 composite