Download the PHP package waughj/file-loader without Composer

On this page you can find all versions of the php package waughj/file-loader. 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 file-loader

File Loader

Object for easily generating image sources with autoversioning for handling cache corruption.

Loader object takes in an optional hash map as its 1 argument ( though using this object without any arguments will just return the very string you give it from getSource ). The object will recognize any & all o' 4 o' the following optional keys for that hash map:

After setting this object up, you can use it to get sources for local filenames easily.

Example

All CSS files are kept in /home/example.com/public_html/assets/css & are loaded from https://www.example.com/assets/css:

use WaughJ\FileLoader\FileLoader;

$loader = new FileLoader
([
    'directory-url' => 'https://www.example.com',
    'directory-server' => '/home/example.com/public_html',
    'shared-directory' => 'assets/css',
    'extension' => 'css'
]);

Then you can easily load files with just the local name with the "getSourceWithVersion" method:

// Get main CSS file
$loader->getSourceWithVersion( 'main' );

This will output "https://www.example.com/assets/css/main.css?m={#######}", with the #s being a long # representing the last modified time.

You can make new versions o' a loader with 1 o' the 4 attributes changed with the following methods, which return a new instance o' the loader object with all the other attributes the same:

To change multiple attributes easily, just chain them:

$loader2 = $loader1->changeURLDirectory( 'https:/www.new-website.com' )->changeExtension( 'sass' );

If you want to change the same loader, just set the loader equal to change, replacing the ol' instance with the new:

$loader1 = $loader1->changeURLDirectory( 'https:/www.new-website.com' )->changeExtension( 'sass' );

Error Handling

The "getSourceWithVersion" method analyzes the file on the server's modified date to create the version string. If it can't access the file, it throws a WaughJ\FileLoader\MissingFileException exception, which includes the server & url paths in it. If you want a safe way to fallback to versionless source without breaking the website or program, run a simple try & catch & in the catch use the exception object's "getFallbackContent" method to get the versionless source:

$file_url = null;
try
{
    $file_url = $loader->getSourceWithVersion( 'main' );
}
catch ( MissingFileException $e )
{
    // Perhaps run some logging code that logs that $e->getFilename() couldn't be found.

    // If exception is thrown, $file_url will be the equivalent o' $loader->getSource( 'main' ).
    $file_url = $e->getFallbackContent();
}

Changelog

0.5.0

0.4.0

0.3.0

0.2.0

0.1.0


All versions of file-loader with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
waughj/directory Version *
waughj/verified-arguments Version *
spatie/url Version *
waughj/test-hash-item Version >=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 waughj/file-loader contains the following files

Loading the files please wait ....