Download the PHP package luminoray/role-php without Composer

On this page you can find all versions of the php package luminoray/role-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package role-php

RolePHP

Welcome to RolePHP, a simple PHP library for creating your own browser RPG. This project is still under very early development.

Installation

RolePHP is available via Composer, so there are a few options for installation (assuming composer is installed, if not, please refer to Composer Installation):

Terminal

Navigate to your project folder and execute the following command:

Dependency definition

This method is useful if you intend your project to depend on more packages other than RolePHP. Create a file on your project's root named composer.json with the following contents:

The dev-master version defined refers to the current status of the master branch in this github project. As development goes on, this should be changed to RolePHP's current version (v1.0, for example). Since RolePHP is still under development, the minimum stability at the moment of updating this README file must be set to dev.

Once the file has been created, navigate to your project folder and execute the following command:

Updating

In order to update your installation of RolePHP, you just need to navigate to your project folder and execute the following command:

This will fetch the latest matching version according to your composer.json file. Please refer to Composer Basic Usage for more information.

Basic usage

RolePHP provides a framework for creating your own PHP-based browser RPG. As such, RolePHP is not immediately useable, as it allows the developer to create their own damage formulas.

Once RolePHP has been installed, you must include the autoload.php file, located in the vendor folder:

Once that file has been included, you will have access to the RolePHP classes, as well as any other dependencies you defined on composer.json during installation. However, the Character class included is an abstract class, and must be extended to fit the developer's needs. When extending Character, you must define the methods as described on the character interface iCharacter, located in /Vendor/LuminoRay/RolePHP/src/character/iCharacter.php:

The Character class already defines the __construct() and __get() methods, which means only attack() and skill() must be defined in our class extension. Here's an example:

Notice that we are using class properties such as attack, defense and health. These properties are defined by the __construct method of the Character class, when passing a Status object to the constructor. At this moment the Character object will contain a Status object, with its own properties and methods.

Notice how at the the end of the attack() method, we call the Status stat_set() method to update the target's health. The function's parameters can be viewed in the status interface iStatus, located in /Vendor/LuminoRay/RolePHP/src/character/iCharacter.php:

Once we have created our own MY_Character class, we can now begin using RolePHP.

Instantiation

Before we create a MY_Character object, we must first create a Status object that will be contained within. To do this we must first define a status associative array, and then we instantiate Status by passing this array to the constructor. Here's an example where we generate stats for two characters:

With the Status objects instantiated, we can now proceed to create our MY_Character instances:

From here on, we can play around, view their stats via $player->health or $player->status->health, and command them to attack each other:

Keep in mind that that properties are read-only, and must be updated via the Status object's stat_set() method.

Have fun!


All versions of role-php with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package luminoray/role-php contains the following files

Loading the files please wait ....