https://github.com/osmphp/core
Provides base classes for building modular PHP applications, and the compiler that bundles modules together. This library is the foundation for Osm Framework.
https://github.com/osmphp/core
Last synced: 12 months ago
JSON representation
Provides base classes for building modular PHP applications, and the compiler that bundles modules together. This library is the foundation for Osm Framework.
- Host: GitHub
- URL: https://github.com/osmphp/core
- Owner: osmphp
- License: gpl-3.0
- Created: 2020-09-08T14:15:09.000Z (over 5 years ago)
- Default Branch: v0.10
- Last Pushed: 2022-03-07T17:54:02.000Z (about 4 years ago)
- Last Synced: 2025-03-26T02:34:53.417Z (about 1 year ago)
- Language: PHP
- Homepage:
- Size: 271 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
* [About osmphp/core](#about-osmphpcore)
* [Prerequisites](#prerequisites)
* [Installation](#installation)
* [Getting Started](#getting-started)
* [Using The Library](#using-the-library)
* [Contributing](#contributing)
* [License](#license)
* [Commercial License & Support](#commercial-license--support)
## About `osmphp/core`
`osmphp/core` enables modular software development in any PHP project - dividing
the application code into modules - reusable, extensible and pluggable parts.
A module is a directory responsible for a single feature or concept of your
application. For example one module may handle products in e-commerce
application, another - authorize users into the application's restricted area,
yet another one - enable the application to be used in the command line, and so
on.
`osmphp/core` is different from other frameworks in several ways:
* **Unprecedented extensibility**. From your module, add new and modify
existing (even protected) methods of any other module class.
* **Smaller footprint, faster execution**. Class property values are computed
only when (and if) they are accessed, unless you explicitly assign them.
* **Simple object instantiation**. Classes know and use their default
dependencies, you don't have to pass them when creating an object. Unless you
want to, for example, when mocking a dependency in a unit test. It also
completely removes the hassle of configuring a dependency injection container.
* **Auto-wiring**. Plug-in your class into the application just by extending a
certain class, or by adding an attribute. The application intimately knows the
class definitions of all the modules, and wires them together without
additional configuration files.
## Prerequisites
This library requires:
* PHP 8
* `mbstring` extension
* Composer
Install them if necessary.
## Installation
Install the `osmphp/core` Composer package:
composer require osmphp/core
## Getting Started
Prepare the project for using the library as described below. In the future, this package will come preinstalled with a project template, and you will not have to write this boilerplate code.
1. Create an application class in the `src/App.php` file (assuming that your project is configured to autoload the `App\` namespace from the `src/` directory; if it's not the case, adjust the code snippets accordingly):