PHPackages                             new-fang/loader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. new-fang/loader

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

new-fang/loader
===============

Loader for files in wordpress making things easier instead of using a require

1.3.1(6y ago)03MITPHPPHP &gt;=5.4.0

Since Jan 26Pushed 4y agoCompare

[ Source](https://github.com/jenksed/loader)[ Packagist](https://packagist.org/packages/new-fang/loader)[ RSS](/packages/new-fang-loader/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (11)Used By (0)

Loader
======

[](#loader)

> Allows to load files from directories with a more sugared syntax, and allowing the use of params passed to the file. Forked from WeAreNolte's [Lean\\Loader](https://github.com/wearenolte/loader) package.

Benefits
========

[](#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:

- More clear sintax of what files and from where are loaded.
- Allow to send variables between files loaded.
- Multiple set of arguments to the partials.
- Keep things DRY.

Requirements
============

[](#requirements)

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

- PHP 5.6
- [composer](https://getcomposer.org/):

Installation
============

[](#installation)

```
composer require moxie-lean/loader
```

Usage
=====

[](#usage)

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

```
// functions.php
include_once( get_stylesheet_directory()  . '/vendor/autoload.php' );
```

```
