https://github.com/marcuwynu23/php-inspector
A PHP-friendly tool to inspect and log PHP classes and objects with reflection.
https://github.com/marcuwynu23/php-inspector
console-log debugging inspection laravel logging php terminal tool
Last synced: 5 months ago
JSON representation
A PHP-friendly tool to inspect and log PHP classes and objects with reflection.
- Host: GitHub
- URL: https://github.com/marcuwynu23/php-inspector
- Owner: marcuwynu23
- Created: 2025-11-04T09:45:24.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-11-04T10:04:10.000Z (8 months ago)
- Last Synced: 2025-11-04T10:07:09.902Z (8 months ago)
- Topics: console-log, debugging, inspection, laravel, logging, php, terminal, tool
- Language: PHP
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PHP Inspector
A PHP-friendly developer tool for logging and inspecting PHP classes, objects, and data structures.
---
## Features
- Log detailed information about a class or object:
- Class name and parent
- Interfaces and traits
- Constants, methods, and properties
- Pretty-printed JSON output for easier debugging
- Can handle objects, classes, arrays, and primitives
- Simple integration with Laravel's logging system (or standard output)
---
## Installation
Install via Composer:
```bash
composer require marcuwynu23/php-inspector
```
For developrnent and testing:
```bash
composer require --dev phpunit/phpunit
```
### Usage
Log a Class
```php
use Marcuwynu23\PHPInspector\PHPInspector;
PHPInspector::log(\DateTime::class);
```
Log an Object
```php
$obj = new stdClass();
$obj->foo = 'bar';
PHPInspector::log($obj);
```
Log an Array or Primitive
```php
PHPInspector::log(['foo' => 'bar']);
PHPInspector::log('Hello World');
```
All output will be printed in JSON format to stdout (or Laravel log if used in Laravel).
### Running Tests
This library uses PHPUnit 10 for testing.
Run tests using Composer.
```bash
composer test
```
This will execute:
```
vendor\bin\phpunit.bat --colors=always
```