Coder Social home page Coder Social logo

ser-pretty's Introduction

ser-pretty

ser-pretty allows you to pretty print serialized PHP data without unserializing it. Therefore, you do not need to have the classes of serialized objects loaded.

$ src/bin/ser-pretty < test.txt 
  class stdClass (1) {
    private $bar =>
    int(223)
  }

But, why?

It happens often that you have serialized PHP data lying around for example from caching, session data or transmitting it through a queue. If you want to inspect this data for debugging purposes, you typically write a tiny script that loads your classes (for de-serialization of objects), fetch the data and display a var dump.

ser-pretty deprecates this step by simply rendering a var_dump() like outut from serialized data, without actually unserializing it.

The CLI

ser-pretty comes with a very simple PHP CLI script, that reads serialized data from STDIN and prints the formatted output to STDOUT. Just call:

$ ser-pretty < dumped_data.txt

You can also pipe serialized data from another script to it.

The Lib

You can also use ser-pretty as a library to integrate pretty printing of serialized PHP data into your debugging/monitoring/โ€ฆ tools. Just look into the CLI script to see what it does.

  • The Parser parses serialized into a very simple AST
  • A Writer turns an AST into a string representation

ser-pretty ships with a var_dump() style writer, the SimpleTextWriter which you can use out of the box.

Installation

Just include ser-pretty in your project via composer using qafoo/ser-pretty.

ser-pretty's People

Contributors

tobys avatar

Watchers

 avatar  avatar  avatar

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.