Download the PHP package sbuerk/composer-files-provider without Composer

On this page you can find all versions of the php package sbuerk/composer-files-provider. 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 composer-files-provider

test main

Composer Files Provider

This plugin acts as composer plugin in order to provide files in a installation aware manner. This means, that it searches in a configured boilerplate folder structure in a defined order for files, based on installation placeholders. To see how this works see corresponding section.

The behaviour of this plugin can be influenced by configuration in the extra section of the root composer.json. See section options for available options.

The mission

We had the need in several projects to provide different files based on some environment specific values, in a waterfall manner. This means, that the first matching file (source) in a defined pattern order will be used and copied to a defined destination (target).

It startet with environment specific .htaccess files, but it extended to other part configuration files to adjust configuration. As we wanted these files in the corresponding git repository to be managed, it startet with kind of bash scripts, duplicated and adjusted for different file types and added as composer scripts.

As it was kind of painfully to maintain these bash scripts over the several repositories, and special the different flavours the need for a sharable and maintainable solution with project-based configuration was born. However, thinking about it there were quite some stones in the way - creating a package with bash scripts would be easy, but because of the nature of configurable bin installation folder this was not quite easy to ensure. And how to provide an easy configuration on project level ?

Then the :bulb: popped up - why not using the project root composer.json as configuration place, and instead of providing bash scripts implementing it as a clean composer plugin. This also enables us to have it tested, linted and more people's may help or contribute to it.

So far, that was the story of the mission and how this package has been born. May it be of help for you.

Alternative

We're not aware of other open extensions that try to achieve the same in a similar way. We may have not searched properly or has been to stupid to find one. Let us know if there is a similar composer plugin.

Supported Versions

version composer versions php versions note
0.x 1.x, 2.x 7.2, 7.3, 7.4, 8.0, 8.1 abandoned - starting development
1.x 1.x, 2.x 7.2, 7.3, 7.4, 8.0, 8.1 actively supported

Installation

Simply add this package as a dependency:

The plugin starts working directly. That means, if you have already provided the needed configuration will be processed directly. See the Info Command section to get more info about the current configuration and what may be matched or not.

Options

Example configuration:

option optional description
template-root yes This defines the template root folder, which will be used to replace the %t% placeholder. Defaults to: file-templates
resolvers yes Here you can configure custom resolver definition(s), or override the default one.
files no If something should be done, at least one file configuration is needed. You can define multiple file definitions, using the same or different resolver stacks.

Config: template-root

The template-root defines the template folder for the file's lookup. The %t% placeholder will be replaced with the configured template-root or the default: file-templates.

Note: The path will trimm of slashes on the right side. So if using in path patterns, you have to add / yourself as directory separator.

Example:

Config: resolvers

You can define custom resolver definitions under resolvers in the format:

You can then decide for a file configuration which resolver you want to use.

:warning: If you define a "default" resolver, the shipped default resolver definition will be completely overridden.: Be very careful here!

Default resolver definition (if not overridden):

Config: files

option optional description
label yes If not set, source will be used as label.
source no Source path/file pattern, will be used to replace the %s% placeholder in the resolver pattern stack.
target no Target path/file - defines where the first matched file will be written to. Supports placeholders too, if needed.
resolver yes Define which resolver should be used. If not available or not provided, default resolver will be used.

:information_source: Resolver fallback / default use means, that it uses the shipped default stack, except default resolver has been overridden.

:warning: Don't commit file with sensitive data (credentials) to your repository: Be very careful here! So do not use this to provide these kind of files out of your repository.

Info command

This package extends composer with a command to get some insights in the configuration and what may happen:

which displays something like that:

Available Placeholders

short description
%s% This will be replaced with the corresponding file block 'source'
%t% This will be replaced with the configured template folder
%h% This will be replaced with the hostname
%u% This will be replaced with the username
%p% This will be replaced with the project folder name
%pp% This will be replaced with the parent folder name of the project folder
%ddev% If processed in DDEV container, this will be replaced with "ddev"
%env(string:envVariableName[:default value])% Env variable placeholder with default value support

Tagging & Releasing

packagist.org is enabled via the casual GitHub hook. For now, no GitHub releases are planed to be created.

Feedback / Bug reports / Contribution

Bug reports, feature requests and pull requests are welcome in the GitHub repository: https://github.com/sbuerk/composer-files-provider


All versions of composer-files-provider with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^7.3 || ^7.4 || ^8.0 || ^8.1
ext-json Version *
composer-plugin-api Version ^1.0.0 || ^2.0.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 sbuerk/composer-files-provider contains the following files

Loading the files please wait ....