Report to html php

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A PHP framework for displaying reports from any data source, including SQL and MongoDB

License

jdorn/php-reports

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

A reporting framework for managing and displaying nice looking, exportable reports from any data source, including SQL and MongoDB.

  • Display a report from any data source that can output tabular data (SQL, MongoDB, PHP, etc.)
  • Output reports in HTML, XML, CSV, JSON, or your own custom format
  • Add customizable parameters to a report (e.g. start date and end date)
  • Add graphs and charts with the Google Data Visualization API
  • Supports multiple database environments (e.g. Production, Staging, and Dev)
  • Fully extendable and customizable
Читайте также:  Spt gppc ru index php

For installation instructions and documentation, check out http://jdorn.github.io/php-reports/

If you have a question, post on the official forum — http://ost.io/@jdorn/php-reports

Reports are organized and grouped in directories. Each report is it’s own file.

A report consists of headers containing meta-data (e.g. name and description) and the actual report (SQL queries, javascript, or PHP code).

All reports return rows of data which are then displayed in a sortable/searchable HTML table.

Reports can be exported to a number of formats including CSV, XLS, JSON, and XML.

The Php Reports framework ties together all these different report types, output formats, and meta-data into a consistent interface.

Here’s an example SQL report:

-- Products That Cost At Least $X -- VARIABLE: SELECT Name, Price FROM Products WHERE Price > ">"

The set of SQL comments at the top are the report headers. The first row is always the report name.

The VARIABLE header tells the report framework to prompt the user for a value before running the report. Once provided it will be passed into the report body («>» in this example) and executed.

// List of All Foods // OPTIONS: // VARIABLE: // "name": "include_inactive", // "display": "Include Inactive?", // "type": "select", // "options": ["yes","no"] // > var query = 'type': 'food'>; if(include_inactive == 'no')  query.status = 'active'; > var result = db.Products.find(query); printjson(result);

As you can see, the structure is very similar. MongoDB reports use javascript style comments for the headers, but everything else remains the same.

You can populate the ‘db’ variable by specifying the «mongodatabase» option.

 //List of Payment Charges //This connects to the Stripe Payments api and shows a list of charges //INCLUDE: /stripe.php //VARIABLE: if($count > 100 || $count < 1) throw new Exception("Count must be between 1 and 100"); $charges = Stripe_Charge::all(array("count" => $count)); $rows = array(); foreach($charges as $charge) < $rows[] = array( 'Charge Id'=>$charge->id, 'Amount'=>number_format($charge->amount/100,2), 'Date'=>date('Y-m-d',$charge->created) ); > echo json_encode($rows); ?>

Again, the header format is very similar.

The INCLUDE header includes another report within the running one. Below is example content of /stripe.php:

 //Stripe PHP Included Report //You can have headers here too; even nested INCLUDE headers! //Some headers will even bubble up to the parent, such as the VARIABLE header //include the Stripe API client require_once('lib/Stripe/Stripe.php'); //set the Stripe api key Stripe::setApiKey("123456"); ?>

Hopefully, you can begin to see the power of Php Reports.

For full documentation and information on getting started, check out http://jdorn.github.io/php-reports/

About

A PHP framework for displaying reports from any data source, including SQL and MongoDB

Источник

Turn a Psalm report to HTML in three easy steps!

Okay so this kinda blew my mind how easy and magical it is, and am mainly writing down this post for myself to remember it. Basically, in case you did not know already, Psalm is a great static analysis tool for PHP, but if you have a ton of errors it can be hard to keep track of everything when your terminal gets flooded. Wouldn’t it be much easier if you could get the output as an HTML page? While there’s no built-in tool for this as far as I can tell, the workaround is surprisingly simple. Let’s get to it.

Prerequisites

Step 1 — Running Psalm

First off, we need to run Psalm, the key here is to save the report as an XML file. This is easy enough to do by redirecting the output to a new file.

vendor/bin/psalm --output-format=xml > psalm-report.xml 

Step 2 — Running the Transformer

This is where the fun part comes in, using something called an XSL Transformer (XSLT) we can transform the XML to HTML. The common way to do this seems to be by using the xsltproc software, but I don’t want to have to download a bunch of stuff, and you know what? We don’t have to. We can run xsltproc online! Simply visit freeformatter.com/xsl-transformer, and copy your XML document to the first input. In the second input you’ll need to add the XSL stylesheet which you can copy from this file: psalm-html-output.xsl.

Step 3 — Saving as local HTML

Screenshot of the result

After the online conversion, all you need to do is copy the contents into a new HTML file in your local text editor. It’s just that easy!

Источник

Оцените статью