PHPackages                             moxie-lean/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. moxie-lean/loader

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

moxie-lean/loader
=================

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

1.3.2(4y ago)637.5k↓48.3%1[3 issues](https://github.com/wearenolte/loader/issues)2MITPHPPHP &gt;=7.4 || &gt;=8.0

Since Jan 26Pushed 4y ago3 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (13)Used By (2)

Loader
======

[](#loader)

[![Build Status](https://camo.githubusercontent.com/e57fb27f07a947d8b7a422dc52009759e2e622fec96018e098c3f00a632c8a7a/68747470733a2f2f7472617669732d63692e6f72672f6d6f7869652d6c65616e2f6c6f616465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/moxie-lean/loader)

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

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 7.4 or PHP 8.0
- [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' );
```

```
