How bcons Displays PHP Debug Data in the Browser
Updated
bcons works by sending an HTTP header that tells your PHP code to start forwarding error and debug messages to a bcons console, which you open either as a browser devtools extension or on the bcons website. This applies when you want PHP messages — logs, variable values, errors, warnings, session data, cookies, and payload information — shown in a structured browser console instead of raw server logs.
The core mechanism
The flow has two sides that meet at a single HTTP header:
- A header is sent that instructs the PHP code to enable sending of error and debugging messages to the bcons console.
- PHP messages are forwarded to that console as they are produced.
- The console renders them in the browser, where you read them.
The header is the switch. Without it, PHP has no instruction to route messages to bcons, so nothing appears in the console.
Where the console lives
bcons provides its console in two forms:
- A browser devtools extension
- The bcons website
Both are described as places where the console is available, so you are not locked into a single viewing surface.
What you actually see
Messages are displayed in separate tabs, which keeps different kinds of data from collapsing into one stream. For each message, the console gives easy access to:
- Time
- Domain
- Source file
- Trace data
Errors and warnings are not just flagged — they are reported with the source file name, line number, and stack trace. That means when something breaks, you can jump from the console entry to the exact location in your code rather than searching server logs for a matching timestamp.
Why this replaces log-reading
The contrast is made explicit on the site: the alternative is error_log() and cryptic server logs. A raw log line can carry a lot of useful data but presents it as one dense string. For example, a single FastCGI stderr entry might contain the current user, an order ID, the payload array, session values, cookies, a billing-information check, and a redirect decision — all run together.
bcons takes that same material and splits it into tabs with time, domain, source file, and trace attached to each entry. The information is the same; the structure is what changes.
Practical details worth knowing
- Consoles on the bcons site are live, so you can click around in them.
- Ctrl+click on any message element copies it to the clipboard — useful when you want to paste a value or trace into an issue or a chat.
What bcons is for
The site states two main goals:
- Display PHP messages in a clear and organized way.
- Implement the browser Console API for PHP to help debug PHP code more efficiently.
So the design intent is not just prettier output — it is to give PHP the kind of console-driven workflow that browser JavaScript developers already use.