2017 © Pedro Peláez
 

library drop

Simple debugging methods with CLI support

image

donatj/drop

Simple debugging methods with CLI support

  • Thursday, August 14, 2014
  • by donatj
  • Repository
  • 2 Watchers
  • 0 Stars
  • 34,466 Installations
  • PHP
  • 12 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 6 % Grown

The README.md

Drop

Latest Stable Version License ci.yml, (*1)

"The most effective debugging tool is still careful thought, coupled with judiciously placed print statements.", (*2)

— Brian Kernighan, "Unix for Beginners" (1979), (*3)

While debugging small issues, you sometimes just want to see the contents of a variable or two. Firing up a full debugger can be overkill for quick problems, and var_dump(…); exit(1); is a little unwieldy and only accepts a single argument., (*4)

drop() is a simple debugging tool that allows you to drop one of more variable's contents in simple format that is friendly and readable on both web and CLI output., (*5)

see() is similar to drop() but it does not halt execution., (*6)

Acknowledgements

This was based on the work of my friend Jon Henderson before it was given its own repo., (*7)

Example

<?php

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

drop(1, 2.0, "3", false, [ 1, 2.0, "3", false ]);

||||||||||||||||||||| Arg No. 0  |||||||||||||||||||||||||||||||||||||||||||



1



||||||||||||||||||||| Arg No. 1  |||||||||||||||||||||||||||||||||||||||||||



2.0



||||||||||||||||||||| Arg No. 2  |||||||||||||||||||||||||||||||||||||||||||



'3'



||||||||||||||||||||| Arg No. 3  |||||||||||||||||||||||||||||||||||||||||||



false



||||||||||||||||||||| Arg No. 4  |||||||||||||||||||||||||||||||||||||||||||



Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] =>
)




||||||||||||||||||||| EOF ||||||||||||||||||||||||||||||||||||||||||||||||||

Requirements

  • php: >=7.1

Installing

Install the latest version with:, (*8)

composer require 'donatj/drop'

Documentation

Function: \drop

function drop(...$args) : void
Parameters:
  • mixed $args - The arguments to expose the values of
Returns:
  • never - Exit's with status 1

A helpful function to empty output buffers and take any number of arguments and expose them., (*9)

This is particularly helpful for looking into arrays and objects to see what information lies
within. This function will also kill the script after echoing the information. This function
takes any number of any typed arguments and displays them all., (*10)

Function: \see

function see(...$args) : void
Parameters:
  • mixed $args

A handy function to expose any number of any typed arguments while NOT killing the script
after output., (*11)

The Versions

14/08 2014

dev-master

9999999-dev

Simple debugging methods with CLI support

  Sources   Download

MIT

The Requires

 

debugging drop

02/04 2014

v1.0.1

1.0.1.0

Simple debugging methods with CLI support

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

debugging drop

02/04 2014

v1.0.0

1.0.0.0

Simple debugging methods with CLI support

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

debugging drop

03/10 2013

v1

1.0.0.0

Simple debugging methods with CLI support

  Sources   Download

MIT

The Requires

 

debugging drop