Download the PHP package moxie-lean/loader without Composer

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

Loader

Build Status

Allows to load files from directories with a more sugared syntax, and allowing the use of params passed to the file.

Benefits

By using the Loader package, instead of the regular get_template_part or any other WordPress default function to load partials or files between templates you have the follow benefits:

Requirements

Make sure you have at least the following in order to use this library.

Installation

Usage

You need to make sure the autoload.php file from composer is included so you can use the functions from other packages.

The function accepts at least two arguments:

You can send as many set of arguments as you want, at the end all sets are merged into a single one with wp_parse_args to create a single set.

Multiple set of arguments.

Tips

Set default values

You can easily set default values to always make sure you have the expected arguments on the partial or to have values that migth be optional like:

Don't render if you don't have an expected value.

In some cases you are expecting a required value and if that value is not present you don't want to render that specifc component, in those situations is better to avoid the render of the component, in order to do that you can return from the template at any point to avoid the following lines to be executed, for example:

Filters

There are a coupple of filters that you can use in order to extend the default functionalitty of the loader. You can place all the filters on functions.php of your theme or any file of your plugin.

Register directories where to look for files.

By default the loader is going to look in the root of the theme but if you have a structure of files such as:

To load files from views directory you can use:

Or if you want to avoid typing partials/ every time you can include a new directory into the search path, with the loader_directories filter, such as:

Whith this change you now can write something like:

`

Register an alias

Alias are used if you want to access a directory in a different name such as if you want to use Load::blocks instead of Load::partials you can rename the directory but to avoid that you can easily just create an alias to call a directory in a different way, with the loader_alias filter, as you can see in the following example:

You only need to specify the key into the $alias variable that you want to create an alias and assign to $alias[ key ] the value with the alias that you want to create.

Which give us a sintax like this:

Road Map


All versions of loader with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4 || >=8.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 moxie-lean/loader contains the following files

Loading the files please wait ....