khaled-rayan/phpconsole
最新稳定版本:v1.0
Composer 安装命令:
composer require khaled-rayan/phpconsole
包简介
A simple PHP library to send console messages to browser's JavaScript console
README 文档
README
PHPConsole is a lightweight PHP library that bridges the gap between PHP server-side logging and browser-based JavaScript console, providing an intuitive way to debug and log information directly from PHP.
🌟 Features
- 📝 Multiple logging methods:
log(),warn(),error(),info() - 📊 Table rendering support
- 🕒 Timing and performance tracking
- 🧮 Counting method calls
- 🔍 Easy-to-use console group functionality
- 🚀 Zero dependencies
- 💻 PHP 7.0+ compatible
📦 Installation
Composer (Recommended)
composer require khaled-rayan/phpconsole
Manual Installation
- Download the
PHPConsole.phpfile - Include it in your project
- Use the namespace
PHPConsole
🚀 Quick Start
<?php use PHPConsole\PHPConsole; $console = new PHPConsole(); // Basic logging $console->log("Hello, World!"); $console->warn("This is a warning"); $console->error("Something went wrong"); // Timing $console->time("Process"); // ... your code ... $console->timeEnd("Process"); // Grouping $console->group("User Details"); $console->log($userDetails); $console->groupEnd();
📖 Documentation
Logging Methods
log($data): Standard console logwarn($data): Warning messageerror($data): Error messageinfo($data): Informational messagetable($array): Display tabular datadump($data): Detailed variable export
Timing Methods
time($label): Start a timertimeLog($label): Log current timertimeEnd($label): End and log timer
Grouping Methods
group($label): Start a console groupgroupCollapsed($label): Start a collapsed groupgroupEnd(): Close a group
Utility Methods
count($label): Count method callscountReset($label): Reset countclear(): Clear console
🤝 Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📋 Requirements
- PHP 7.0+
- Web browser with JavaScript console support
🔒 License
Distributed under the GNU Lesser General Public License v2.1.
See LICENSE for more information.
👨💻 Author
Khaled M. Ryan - khaled@krayan.net
🌐 Project Links
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2025-03-27