https://github.com/xp-framework/core
The XP Framework is an all-purpose, object oriented PHP framework.
https://github.com/xp-framework/core
annotations date-time enums generics io php php7 php8 php8-features reflection streams type-system unicode xp-framework
Last synced: 8 months ago
JSON representation
The XP Framework is an all-purpose, object oriented PHP framework.
- Host: GitHub
- URL: https://github.com/xp-framework/core
- Owner: xp-framework
- License: other
- Created: 2013-11-09T16:37:32.000Z (about 12 years ago)
- Default Branch: main
- Last Pushed: 2025-04-21T08:10:34.000Z (9 months ago)
- Last Synced: 2025-04-21T09:24:50.493Z (9 months ago)
- Topics: annotations, date-time, enums, generics, io, php, php7, php8, php8-features, reflection, streams, type-system, unicode, xp-framework
- Language: PHP
- Homepage:
- Size: 46.2 MB
- Stars: 19
- Watchers: 17
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE.md
Awesome Lists containing this project
README
XP Framework Core
=================
[](https://github.com/xp-framework/core/actions)
[](https://ci.appveyor.com/project/thekid/core)
[](https://github.com/xp-framework/core/blob/master/LICENSE.md)
[](http://php.net/)
[](http://php.net/)
[](https://packagist.org/packages/xp-framework/core)
This is the XP Framework's development checkout.
Installation
------------
If you just want to use the XP Framework, grab a release using `composer require xp-framework/core`. If you wish to use this development checkout, clone this repository instead.
### Runners
The entry point for software written in the XP Framework is not the PHP
interpreter's CLI / web server API but either a command line runner or
a specialized *web* entry point. These runners can be installed by using
the following one-liner:
```sh
$ cd ~/bin
$ curl -sSL https://baltocdn.com/xp-framework/xp-runners/distribution/downloads/i/installer/setup-9.1.0.sh | sh
```
### Using it
To use the the XP Framework development checkout, put the following in your `~/bin/xp.ini` file:
```ini
use=/path/to/xp/core
```
Finally, start `xp -v` to see it working:
```sh
$ xp -v
XP 12.4.1-dev { PHP/8.4.6 & Zend/4.4.6 } @ Windows NT SURFACE 10.0 build 26100 (Windows 11) AMD64
Copyright (c) 2001-2025 the XP group
FileSystemCL<./src/main/php>
FileSystemCL<./src/test/php>
FileSystemCL<./src/main/resources>
FileSystemCL<./src/test/resources>
FileSystemCL<.>
```
Basic usage
-----------
The XP Framework runs scripts or classes.
### Hello World
Save the following sourcecode to a file called `ageindays.script.php`:
```php
getDays(), ' days old');
```
Now run it:
```sh
$ xp ageindays.script.php 1977-12-14
Hey, you are 16015 days old
```
Alternatively, you can put this code inside a class and give it a static *main* method. This way, you can use features like inheritance, trait inclusion etcetera. This time, save the code to a file called `AgeInDays.class.php`.
```php
getDays(), ' days old');
return 0;
}
}
```
*Note the arguments have shifted by one: If you want the class' name, simply use `self::class`!*
```sh
$ xp AgeInDays 1977-12-14
Hey, you are 16015 days old
```
Contributing
------------
To contribute, use the GitHub way - fork, hack, and submit a pull request! :octocat:
**Enjoy!**