osmphp / core
Enables modular software development in any PHP project
Installs: 523
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/osmphp/core
Requires
- php: >=8.0
- ext-mbstring: *
- nikic/php-parser: ^4
- phpdocumentor/reflection-docblock: ^5
- symfony/lock: ^5
Requires (Dev)
- phpunit/phpunit: ^9
- v0.10.x-dev
- v0.10.19
- v0.10.18
- v0.10.17
- v0.10.16
- v0.10.15
- v0.10.14
- v0.10.13
- v0.10.12
- v0.10.11
- v0.10.10
- v0.10.9
- v0.10.8
- v0.10.7
- v0.10.6
- v0.10.5
- v0.10.4
- v0.10.3
- v0.10.2
- v0.10.1
- v0.10.0
- v0.9.x-dev
- v0.9.5
- v0.9.4
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.13
- v0.8.12
- v0.8.11
- v0.8.10
- v0.8.9
- v0.8.8
- v0.8.7
- v0.8.6
- v0.8.5
- v0.8.4
- v0.8.3
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.1
- v0.7.0
- v0.6.17
- v0.6.16
- v0.6.15
- v0.6.14
- v0.6.13
- v0.6.12
- 0.6.11
- v0.6.10
- v0.6.9
- v0.6.8
- v0.6.7
- v0.6.6
- v0.6.5
- v0.6.4
- v0.6.3
- v0.6.2
- v0.6.1
- v0.6.0
- v0.5.4
- v0.5.3
- v0.5.2
- v0.5.1
- v0.5.0
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.x-dev
- v0.3.2
- v0.3.1
- v0.3.0
- v0.2.6
- v0.2.5
- v0.2.4
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2.0
This package is auto-updated.
Last update: 2025-06-08 00:56:17 UTC
README
- About osmphp/core
- Prerequisites
- Installation
- Getting Started
- Using The Library
- Contributing
- License
- 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
- mbstringextension
 
- 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.
- 
Create an application class in the src/App.phpfile (assuming that your project is configured to autoload theApp\namespace from thesrc/directory; if it's not the case, adjust the code snippets accordingly):<?php declare(strict_types=1); namespace App; use Osm\Core\App as BaseApp; class App extends BaseApp { }
- 
Create a module group class and in the src/ModuleGroup.php:<?php declare(strict_types=1); namespace App; use Osm\Core\ModuleGroup as BaseModuleGroup; class ModuleGroup extends BaseModuleGroup { }
- 
Compile the application (in Windows, use \instead of/):php vendor/osmphp/core/bin/compile.php App\App
- 
In your entry point file public/index.php(there may be more than one entry point file, add the following to every one of them), make sure that the code is executed in context of the application object:<?php declare(strict_types=1); use Osm\Runtime\Apps; use App\App; ... Apps::$project_path = dirname(__DIR__); Apps::run(Apps::create(App::class), function() { ... });
Using The Library
Documentation is a work in progress. This section will be updated once it is ready.
Contributing
Your help is really welcome, be it a reported bug, an occasional pull request, or the full fledged participation. To get started, open an issue and tell us that you want to be a part of it, and we'll get in touch.
License
The osmphp/core package is open-sourced software licensed under the GPL v3 license.
Commercial License & Support
In case the open source license if not a good fit for you, or if you need support, let me know.