https://github.com/nunomaduro/yorn
⚗️ Modules in PHP with the `import` and `export` syntax
https://github.com/nunomaduro/yorn
modules php
Last synced: 10 days ago
JSON representation
⚗️ Modules in PHP with the `import` and `export` syntax
- Host: GitHub
- URL: https://github.com/nunomaduro/yorn
- Owner: nunomaduro
- License: mit
- Created: 2019-08-31T00:45:40.000Z (over 5 years ago)
- Default Branch: feat/first
- Last Pushed: 2021-11-21T18:23:18.000Z (over 3 years ago)
- Last Synced: 2025-03-27T06:44:58.388Z (27 days ago)
- Topics: modules, php
- Language: PHP
- Homepage: https://nunomaduro.com
- Size: 2.42 MB
- Stars: 144
- Watchers: 5
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
![]()
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).