Giter Site home page Giter Site logo

florianwolters / php-component-core-debugprint Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 444 KB

The Debug Print Method implementation pattern as a PHP component.

Home Page: http://blog.florianwolters.de/PHP-Component-Core-DebugPrint

License: GNU Lesser General Public License v3.0

PHP 100.00%

php-component-core-debugprint's Introduction

Component\Core\DebugPrint

Component\Core\DebugPrint is a simple-to-use PHP component that provides the Debug Print Method implementation pattern as an interface and a trait.

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight Coverage Status

Latest Stable Version Total Downloads Monthly Downloads Daily Downloads Latest Unstable Version License

Stories in Ready Dependency Status Dependencies Status HHVM Status

Table of Contents (ToC)

Introduction

This component is inspired by the method java.lang.Object.toString of the Java programming language.

Component\Core\DebugPrint consists of two artifacts:

  1. The interface FlorianWolters\Component\Core\DebugPrintInterface: Indicates that an implementing class provides a Debug Print Method for objects.
  2. The trait FlorianWolters\Component\Core\DebugPrintTrait: Provides a default Debug Print Method implementation for objects.

Features

  • Offers a default hash code value implementation for objects via the method toString of the trait FlorianWolters\Component\Core\DebugPrintTrait. Refer to the section Usage below for an example.
  • Allows to create a custom hash code value implementation by implementing the interface FlorianWolters\Component\Core\DebugPrintInterface, more precisely implementing the public method toString of that interface. Refer to the section Usage below for an example.
  • Artifacts tested with both static and dynamic test procedures:
  • Provides a Packagist package which can be installed using the dependency manager Composer. Click here for the package on Packagist.
  • Provides a complete Application Programming Interface (API) documentation generated with the documentation generator Sami. Click here for the API documentation.
  • Follows the following "standards" from the PHP Framework Interoperability Group (FIG). PSR stands for PHP Standards Recommendation:
    • PSR-0: Autoloading Standards

      Aims to provide a standard file, class and namespace convention to allow plug-and-play code.

    • PSR-1: Basic Coding Standard

      Aims to ensure a high level of technical interoperability between shared PHP code.

    • PSR-2: Coding Style Guide

      Provides a Coding Style Guide for projects looking to standardize their code.

    • PSR-4: Autoloader

      A more modern take on autoloading reflecting advances in the ecosystem.

  • Follows the Semantic Versioning (SemVer) specification version 2.0.0.

Requirements

Production

Development

Installation

Component\Core\DebugPrint should be installed using the dependency manager Composer.

Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.

The Composer installer can be downloaded with php.

php -r "readfile('https://getcomposer.org/installer');" | php

This will just check a few PHP settings and then download composer.phar to your working directory. This file is the Composer binary. It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line, amongst other things.

To resolve and download dependencies, run the install command:

php composer.phar install

If you are creating a component that relies on Component\Core\DebugPrint, please make sure that you add Component\Core\DebugPrint to your component's composer.json file:

{
    "require": {
        "florianwolters/component-core-debugprint": "0.3.*"
    }
}

Usage

The best documentation for \Component\Core\DebugPrint are the unit tests, which are shipped in the package.

The most important usage rule:

Always implement the interface DebugPrintInterface if using the trait DebugPrintTrait, since that allows Type Hinting.

The class DebugPrintExample can be run via the command php resources/php/DebugPrintExample.php from the root of the project.

Default Debug Print Method

The class DebugPrintDefaultImpl uses the default implementation of the trait DebugPrintTrait.

Custom Debug Print Method

The class DebugPrintCustomImpl implements a custom implementation, which fulfills the design contract for a Value Object.

Testing

phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see https://gnu.org/licenses/lgpl.txt.

php-component-core-debugprint's People

Contributors

florianwolters avatar

Watchers

 avatar  avatar

php-component-core-debugprint's Issues

Package not available via Composer

Using either
"require" {
"florianwolters/component-core-debugprint": "dev-master"
}
as specified at Packagist.org
or

"require" {
"florianwolters/component-core-debugprint": "0.2.*"
}
as specified in Git readme leads to error:

Problem 1
- Installation request for florianwolters/component-number-fraction dev-master -> satisfiable by florianwolters/component-number-fraction[dev-master].
- florianwolters/component-number-fraction dev-master requires florianwolters/component-core-debugprint dev-master -> no matching package found.

i.e. this package nor those that depend on it are installable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.