Skip to content

Latest commit

 

History

History
98 lines (65 loc) · 4.82 KB

README.md

File metadata and controls

98 lines (65 loc) · 4.82 KB

PHP: Nelson Martell Library

Travis Build Status Scrutinizer Scrutinizer Coverage Scrutinizer Build Status VersionEye

GitHub release Latest Version Latest unstable Version Waffle.io GitHub commits

License API Documentation Wiki Documentation

Join the chat at https://gitter.im/nelson6e65/php_nml

Table of content

  1. Description
  2. Requirements
  3. Installation
  4. Usage
    1. Code Analysis

Description

Provides a set of classes for PHP applications.

Note: This is an unstable repository in development and should be treated as an alpha.

Requirements

  • PHP 5.5 or greater
  • CakePHP Utility Classes ^3.0.1 or grater - Only required the Cake\Utility\Text class (this is installed by Composer autotically).

Installation

Use this instructions to install NML into your vendor directory as nelson6e65/php_nml.

You will need Composer install and update NML and dependecies. For other alternative instructions, read alternative instructions.

  • Move to your project root directory. Example: cd /var/www/html/my-awesome-php-project.
  • Run composer require nelson6e65/php_nml. This installs php_nml and dependencies in your vendor directory (your composer.json will be updated).
  • Configure your app to autoload classes by including the composer autoloader (vendor/autoload.php) in your config.php or bootstrap.php (or whatever file that performs your autoloads). In most of modern PHP frameworks this is made automatically.

Read more about Composer installs here.

Note: Remember to add your vendor dependencies to your .gitignore file. (See why).

Usage

After install NML and configure your application, you will be able to use NML classes by importing/aliasing with the use operator:

<?php
//Example of Version usage:
use NelsonMartell\Version;

$nmlVersion = new Version(0, 6);

// Create Version object parsing from string
$nmlVersion = Version::parse('0.6.0');

// Explicit to string
echo $nmlVersion->toString();

// Implicit to string
echo $nmlVersion;
?>

<p>Nelson Martell Library, version <?= $nmlVersion ?></p>

For more details about available classes from NML, you can check the API Documentation.

Code Analysis

You can, optionally, define the CODE_ANALYSIS constant if you like some notices and warnings to be throws while you are coding/debugging. This is useful to watch some recommendations about usage of some classes, functions, methods, etc.

<?php
    # app/config.php
    # . . .

    define('CODE_ANALYSIS', true);

    # . . .
?>