Download the PHP package perchten/neat_html without Composer

On this page you can find all versions of the php package perchten/neat_html. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package neat_html

neat_html

Prettier html printing of php objects and arrays

Installation

Via Composer

Neat_html is available on Packagist (perchten/neat_html) and as such is installable via Composer.

Add the following to your composer.json

{
    "require": {s
        "perchten/neat_html": "1.*"
    }
}
Direct include

Clone or download from GitHub and include directly in your code:

require_once "path/to/neat_html.php"

Usage

Simple neat_html
neat_html($somevar)

Will print $somevar into html as a <pre>-wrapped block formatted like JSON.

Return, Don't Print
$output = neat_html($somevar,true)

As with neat_html($somevar) except that the output is returned, captured in the $output variable and not printed.

Die Immediately After Debug Print
neat_html($somevar,"die")

Outputs the formatted $somevar and then dies.

Output as Html Comment
neat_html($somevar,"comment")

Outputs the formatted code in comment form. comments start <!--neat_html for easy searching.

Do not wrap in <pre> tags
neat_html($somevar,"nopre")

Outputs the formatted code without wrapping it in <pre> tags. Useful for console printing.

Print Included Files
neat_html($somefileref,'include)

Takes $somefileref as a file reference and includes that file's contents. Obviously, if the included file uses undefined variables then it will fail.

Also, the file reference must be absolute. For convenience a truepath function is included to get the real path. (PHP's realpath() function is a bit buggy, so best not use that. see http://stackoverflow.com/questions/4049856/replace-phps-realpath). e.g.

neat_html(truepath($somefileref),'include')
Output in JSON (Handy For Ajax)
neat_html($somevar,'json')

Returns the object in json notation. Handy when debugging over ajax that expects a json response.

Output in PHP (Handy For Purists ;))
neat_html($somevar,'php')

Returns the object in php notation. This then uses the var_export function instead of print_r. So the returned values here can even be interpreted directly as php variables.

Multiple Arguments

You can also collect multiple arguments together in a second argument array as follows:

neat_html($somevar,array("include","comment","return");

Or as a comma or space separated list:

neat_html($somevar,"include, comment, return");

And, as of v1.2 you can even use dynamic arguments:

neat_html($somevar,"include","comment","return");
var_dump
neat_html($somevar,'dump');

This will run all data manipulation on $somevar (including if it is a file include), and then var_dump the result in addition to outputting in any other specified formatting.

Defaults

You can set defaults at a global level if you find yourself repeating the same optional arguments all the time.

Neat_Html::setDefault($option);

Neat_Html::getDefaults();

Neat_Html::setDefaults($optionsArray);

Neat_Html::removeDefault($option);  
Enabling/Disabling

neat_html statements will run by default, but you can control this by switching the functionality on and off globally, and querying the current state.

Neat_Html::setOn() // switches this module on globally

Neat_Html::setOff() // switches this module off globally

Neat_Html::isOn() // return true if module is on, otherwise false

License

Neat_html is licensed under the MIT License - see the LICENSE file for details


All versions of neat_html with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package perchten/neat_html contains the following files

Loading the files please wait ....