josantonius/notice

This package is abandoned and no longer maintained. No replacement package was suggested.

PHP library for handling errors and notices.

1.1.3 2017-09-14 02:44 UTC

This package is auto-updated.

Last update: 2020-01-24 16:27:33 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

Versión en español

PHP library for handling errors and notices.

Installation

The preferred way to install this extension is through composer.

To install PHP Notice library, simply:

$ composer require Josantonius/Notice

The previous command will only install the necessary files, if you prefer to download the entire source code (including tests, vendor folder, exceptions not used, docs...) you can use:

$ composer require Josantonius/Notice --prefer-source

Or you can also clone the complete repository with Git:

$ git clone https://github.com/Josantonius/PHP-Notice.git

Requirements

This library is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher.

Quick Start and Examples

To use this class, simply:

require __DIR__ . '/vendor/autoload.php';

use Josantonius\Notice\Notice;

Available Methods

Available methods in this library:

Notice::get();
Notice::getAll();

Usage

Example of use for this library:

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

use Josantonius\Notice\Notice;

echo "<br>[600] · " . Notice::get(600);
echo "<br>[600] · " . Notice::get(600, 'es');

/*
[600] · This is a test for the error with code 600 in english.
[600] · This is a test for the error with code 600 in spanish.
*/

echo "<br>[800] · " . Notice::get(800);

/*
[800] · Undefined
*/

echo '<pre>'; var_dump(Notice::getAll()); echo '</pre>';

/*
array(2) {
  [600]=>
  string(54) "This is a test for the error with code 600 in english."
  [601]=>
  string(54) "This is a test for the error with code 601 in english."
}
*/

echo '<pre>'; var_dump(Notice::getAll('es')); echo '</pre>';

/*
array(2) {
  [600]=>
  string(58) "Esto es un test para el error con código 600 en español."
  [601]=>
  string(58) "Esto es un test para el error con código 601 en español."
}
*/

Tests

To use the test class, simply:

<?php
$loader = require __DIR__ . '/vendor/autoload.php';

$loader->addPsr4('Josantonius\\Notice\\Tests\\', __DIR__ . '/vendor/josantonius/notice/tests');

use Josantonius\Notice\Tests\NoticeTest;

Available test methods in this library:

NoticeTest::testLoad();
NoticeTest::testLoadES();
NoticeTest::testGetEN();
NoticeTest::testGetES();
NoticeTest::testGetUndefinedEN();
NoticeTest::testGetUndefinedES();
NoticeTest::testGetAllEN();
NoticeTest::testGetAllES();

Contribute

  1. Check for open issues or open a new issue to start a discussion around a bug or feature.
  2. Fork the repository on GitHub to start making your changes.
  3. Write one or more tests for the new feature or that expose the bug.
  4. Make code changes to implement the feature or fix the bug.
  5. Send a pull request to get your changes merged and published.

This is intended for large and long-lived objects.

Repository

All files in this repository were created and uploaded automatically with Reposgit Creator.

License

This project is licensed under MIT license. See the LICENSE file for more info.

Copyright

2017 Josantonius, josantonius.com

If you find it useful, let me know 😉

You can contact me on Twitter or through my email.