Download the PHP package helsingborg-stad/s3-local-index without Composer

On this page you can find all versions of the php package helsingborg-stad/s3-local-index. 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 s3-local-index

S3 Local Index

A WordPress plugin that provides local indexing of S3 files with CLI commands and cache flushing capabilities. This plugin improves performance when working with large S3 buckets by creating local indexes that enable fast file existence checks and directory listings without expensive S3 API calls.

This plugin is tested with a bucket of over 1 000 000 files.

Description

The S3 Local Index plugin creates and maintains local JSON index files that mirror the structure of your S3 bucket. This enables WordPress to quickly determine if files exist on S3 without making API calls for every check. The plugin supports both single-site and multisite WordPress installations.

Key Features

Index maintanaince

The plugin will maintain the index when files are deleted and uploaded to reflect the changes. This functionality is designed using WordPress standard hooks. This plugin requires that you manage files "the right way", not registering files in WordPress will cause not_found errors. Although you may lessen the issue by running the create command often (this reflects everyting in the bucket).

The flowing file changes will be captured:

Good to know & limitations

Requirements

Installation

  1. Install via Composer (recommended):

  2. Manual Installation:

    • Download the plugin files
    • Upload to /wp-content/plugins/s3-local-index/
    • Run composer install in the plugin directory
  3. Activate the Plugin:
    • Through WordPress admin: Plugins → Installed Plugins → Activate "S3 Local Index"
    • Via WP-CLI: wp plugin activate s3-local-index

Configuration

The plugin is enabled by default when the S3 Uploads plugin is active. You can customize behavior using WordPress filters:

Available Filters

Cache Directory Configuration

The plugin automatically prevents collisions between multiple sites on the same server by using unique cache directories. Each site gets its own cache directory based on its document root:

Examples:

You can override this behavior using the S3_Local_Index/Config/GetCacheDirectory filter to specify a custom cache directory location.

CLI Commands

The plugin provides a WP-CLI command for managing S3 indexes:

Create Full Index

Creates a complete index by scanning all objects in the S3 bucket. It is recommended to setup this action as a daily cron, to eshure that the index is as accurate as possible over time (it is however maintained when a file is deleted or added in realtime).

This command:

How It Works

Index Structure

The plugin creates JSON index files organized by:

Index files are stored as: {cache-directory}/s3-index-{blogId}-{year}-{month}.json

The cache directory is automatically generated to be unique per site (e.g., /tmp/s3-index-0f256ede/) to prevent collisions when multiple sites run on the same server.

File Path Patterns

The plugin recognizes these S3 path patterns:

Single Site:

Multisite:

Multisite Multi Network:

Caching Strategy

The plugin uses a multi-layer caching approach:

  1. Static Cache: In-memory cache for the current request
  2. WordPress Object Cache: Persistent cache using WordPress's object cache system
  3. Composite Cache: Combines both strategies for optimal performance

Cache keys follow the pattern: index_{blogId}_{year}_{month}

Stream Wrapper Integration

The plugin registers a custom S3 stream wrapper that:

Running Tests

If tests are available, run them with:

Code Standards

The plugin follows PSR-4 autoloading and PSR-12 coding standards. All classes use dependency injection and implement appropriate interfaces for testability.

Troubleshooting

Common Issues

Plugin not working:

Index files not created:

Performance issues:

Multiple sites on same server:

Debug Logging

The plugin logs important events to the WordPress error log:

Enable WordPress debug logging in wp-config.php:

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Make your changes with proper documentation
  4. Add or update tests as needed
  5. Submit a pull request

Please ensure all new code includes proper PHPDoc blocks and follows the existing code style.

License

This plugin is licensed under the MIT License. See the composer.json file for details.

Authors

Support

For issues and questions:


All versions of s3-local-index with dependencies

PHP Build Version
Package Version
Requires helsingborg-stad/wpservice Version ^2.0
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 helsingborg-stad/s3-local-index contains the following files

Loading the files please wait ...