Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nunomaduro/yorn

⚗️ Modules in PHP with the `import` and `export` syntax
https://github.com/nunomaduro/yorn

modules php

Last synced: about 2 months ago
JSON representation

⚗️ Modules in PHP with the `import` and `export` syntax

Awesome Lists containing this project

README

        


Yorn Preview


Build Status
Total Downloads
Latest Version
License



Modules in PHP with the `import` and `export` syntax.

**Yorn** was carefully crafted to introduce the support for modules in **PHP** with the `import` and `export` syntax. It was created by **[Nuno Maduro](https://github.com/nunomaduro)**.

Before the quick start, keep in mind that a module usually contains a collection of functions, and those functions are small units of independent, reusable code that is desired to be used as the building blocks in creating a PHP application.

As example, this is how a typical **Yorn** application would look like:
```php
# src/math/sum.php:
Remember, this is just an experiment. Don't use this in production.

```
# First, install:
composer require nunomaduro/yorn
```

## ✨ Exporting a function

Any function can be exported by using the `export` function:
```php
# src/validators/zipCodeValidator.php:
zipCodeValidator;

echo $zipCodeValidator(8000);
```

## 💖 Support the development
**Do you like this project? Support it by donating**

- PayPal: [Donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L)
- Patreon: [Donate](https://www.patreon.com/nunomaduro)

Yorn is open-sourced software licensed under the [MIT license](LICENSE.md).