Download the PHP package marktaborosi/storage-navigator without Composer

On this page you can find all versions of the php package marktaborosi/storage-navigator. 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 storage-navigator

Storage Navigator

Author Latest Version Software License Downloads php 8.2+ CI

Table of Contents

Storage Navigator

A simple, lightweight, and universal storage/file browser and navigator library with rendering options.

This library allows accessing various storage systems via adapters and rendering their contents using different renderers. It supports navigating and displaying storage contents across various platforms, including FTP, SFTP, local filesystems, and more.

Supported Adapters

Adapters are the backbone of the Storage Navigator library, enabling seamless integration with various storage systems. They act as abstraction layers that standardize communication with diverse storage backends, such as local file systems, cloud storage, FTP servers, and more. By decoupling the specific implementation details of storage systems, adapters ensure a unified interface for interacting with files and directories, regardless of the underlying storage type.

Adapters allow developers to effortlessly navigate, manage, and interact with storage systems, making the library versatile and adaptable to a wide range of use cases.

For advanced requirements, custom adapters can be implemented using the StorageNavigatorAdapterInterface, providing the flexibility to extend functionality and support additional storage platforms while maintaining compatibility with the library's architecture.

Supported Renderers

A Renderer is a crucial component in the Storage Navigator library, responsible for transforming the raw data collected by the adapters into a visually interpretable format. Renderers determine how the storage contents, such as files and directories, are displayed to the user, whether in a web browser, a command-line interface, or a debugging environment. Each renderer is tailored to a specific context, providing the necessary features and styling to meet diverse usage scenarios. By decoupling the rendering logic from data retrieval, Storage Navigator ensures maximum flexibility and adaptability across different platforms and environments.

For advanced scenarios, you can implement a custom renderer by utilizing the StorageNavigatorRendererInterface, which defines the necessary methods and structure for creating a tailored rendering solution. This allows developers to seamlessly integrate unique rendering logic that aligns with their application's requirements, while maintaining compatibility with the Storage Navigator ecosystem.

Installation

You can install Storage Navigator via Composer:

`

Usage

Below are examples of how to use Storage Navigator with different adapters and renderers.

Native Adapter Example

Flysystem Adapter with Local Adapter Example

For detailed information on Flysystem, its adapters, and usage, please refer to the Flysystem Documentation.

FTP Adapter Example

SFTP Adapter Example

S3 Adapter Example

Unified Archive Adapter Example

ZIP Archive Adapter Example

Renderers

HTML Renderer

Configuration

You can configure various options for the file browser, such as:

HTML Renderer has navigation and file download support. Each theme provides a different look and feel for the file browser.

Below are some screenshots of the available themes:

basic-dark

basic-light

basic-mac

basic-norton

basic-terminal

console-hacker

console-midnight-commander

console-norton-commander

bootstrap-mason-light

Console Renderer

Important! The Console renderer does not have navigation functionality.

To use the Console Renderer in a CLI environment, you can instantiate it as follows:

It looks structurally similar to a Windows DIR command:

File Structure Filtering

The FileStructureFilterBuilder class is a utility for constructing filters to navigate and filter file and directory structures. It allows fine-grained control over what files or directories are displayed by applying various filtering criteria.


Usage

The FileStructureFilterBuilder provides a fluent interface to add filters. Each filter can narrow down the results based on file or directory attributes such as name, type, or extension.

Note: Currently, all filters are combined using a logical "AND" operation. Logical expressions such as "OR" or grouped conditions are under development.


Filtering Options

1. Filter by Type


2. Filter by Name


3. Filter by File Extension

(Applies only to files.)


4. Combining Filters

All filters are combined with a logical "AND" operation. This means that only files or directories that meet all the specified conditions will be included.

Example:

To include only .txt files whose names contain log:


Retrieving the Filters

Once all filters are configured, you can retrieve them using the getFilters() method. The filters are returned as an array of callables that can be applied to entries in the file structure.


Creating Your Own Adapter

The StorageNavigatorAdapterInterface provides a contract for creating custom adapters in the Storage Navigator library. Adapters are responsible for interacting with various storage backends, such as local file systems, SFTP servers, or cloud storage solutions, and translating their structure and operations into a standardized format for the Storage Navigator.

This guide outlines the steps to implement your own adapter.


1. Understanding the StorageNavigatorAdapterInterface

The StorageNavigatorAdapterInterface defines three core methods:


2. Steps to Implement a Custom Adapter

Step 1: Create a New Class

Start by creating a class that implements the StorageNavigatorAdapterInterface.


Step 2: Implement the fileOrDirectoryExists Method

This method determines if a file or directory exists at the specified location.
For example, in a cloud storage adapter, you might query the storage API:

For local file systems, you can use PHP's file_exists function:


Step 3: Implement the getFileStructure Method

This method retrieves the structure of a directory and returns it as a FileStructure object. You can use the FileStructureBuilder class to construct the structure.

Example for a local file system:


Step 4: Implement the downloadFile Method

The downloadFile method handles file downloading. This typically involves sending the file's contents to the client with appropriate HTTP headers.

Example:


3. Example: Minimal Adapter

Here's a minimal example of an adapter for a custom storage system:


4. Advanced Customization

For complex storage systems, consider:


5. Testing Your Adapter

Test your adapter thoroughly with:


By following these steps, you can create a custom adapter that integrates seamlessly with the Storage Navigator library and provides access to your desired storage backend.

Creating Your Own Renderer

The StorageNavigatorRendererInterface defines a flexible and extensible contract for creating custom renderers in the Storage Navigator library. Renderers are responsible for displaying the data fetched by adapters in a desired format, whether as an HTML page, CLI output, or any other custom view.

This guide walks you through the process of implementing your own custom renderer.


1. Understanding the StorageNavigatorRendererInterface

The StorageNavigatorRendererInterface contains two core methods you need to implement:


2. Steps to Implement a Custom Renderer

Step 1: Create a New Class

Start by creating a class that implements the StorageNavigatorRendererInterface.


Step 2: Implement the render Method

The render method receives a RenderData object, which contains the current file structure, navigation paths, and other data needed for rendering. Customize this method to output the data in your desired format.

For example, to render as JSON:


Step 3: Implement the navigationHandler Method

The navigationHandler method returns a StorageNavigatorNavigationHandlerInterface implementation. This handles navigation actions like changing directories or downloading files.

If no navigation logic is needed, you can return a NullNavigationHandler:

For custom navigation handling, create a new class implementing StorageNavigatorNavigationHandlerInterface:


Step 4: Register and Use Your Renderer

Instantiate your custom renderer and pass it to the StorageNavigator:


3. Example: Minimal Renderer

Here's a minimal example of a renderer that outputs a plain-text file list:


4. Advanced Customization

You can leverage additional tools or libraries, like Twig for templating, or integrate third-party APIs for advanced rendering. For instance:


5. Testing Your Renderer

Before integrating your renderer, test it with different data sets to ensure it handles various file structures, edge cases, and error scenarios. Use the RenderData class to simulate test inputs.


By following these steps, you can create a custom renderer tailored to your application's needs while maintaining compatibility with the Storage Navigator's architecture.

Contributing

If you'd like to contribute to the project, feel free to fork the repository and submit a pull request.


All versions of storage-navigator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
twig/twig Version ^3.11
league/flysystem Version ^3.28
ext-zip Version *
ext-ftp Version *
phpseclib/phpseclib Version ^3.0
wapmorgan/unified-archive Version ^1.2
aws/aws-sdk-php Version ^3.342
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 marktaborosi/storage-navigator contains the following files

Loading the files please wait ....