nicmart / PhpLibraryBoilerplate

A basic template I use every time I create a new php library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Php library template

This is the basic skeleton I use each time I create a new php library. It includes basic phpunit, travisci and composer configuration, and a basic folder structure.

There are few template variables I substitute with a "find and replace" each time I initialize the library. This variables are

  • {library-name} The name of the library
  • {library-name-slug} The sluggified version of library name, used in composer configuration
  • {library-desc} A brief descrption of what the library does
  • {library-namespace} The main library namespace. I usually set this equal to the camelized library name

Other values like library author name and email are hardcoded in the files.

What follows is the skeleton README.md file.

{library-name}

Build Status Coverage Status Scrutinizer Quality Score

{library-desc}.

Install

The best way to install {library-name} is through composer.

Just create a composer.json file for your project:

{
    "require": {
        "nicmart/{library-name-slug}": "~0.1"
    }
}

Then you can run these two commands to install it:

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install

or simply run composer install if you have have already installed the composer globally.

Then you can include the autoloader, and you will have access to the library classes:

<?php
require 'vendor/autoload.php';

About

A basic template I use every time I create a new php library

License:MIT License


Languages

Language:PHP 100.0%