News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Developer Drive:
Simplify your documentation process with Couscous
December 19, 2014 @ 12:14:49

On the Developer Drive site today there's a quick post introducing you to Couscous, a PHP-based documentation generation tool. Couscous translates your Markdown files into HTML output that's professional and clean looking.

If there's one thing I hate more than tracking down bugs, it's documenting code. It takes forever, it's almost a project in itself, and I never seem to factor it into my project lifecycle. Setting out to solve that problem for me, and anyone else whose life is too short, is Couscous. Couscous takes markdown files and converts them into professional standard HTML docs that colleagues, or fellow developers, can easily follow. You can preview the resulting site on your local machine, correct any issues, and then deploy straight to GitHub where it will be hosted for you.

They walk you through the (brief) process of getting the tool installed via Composer and using it to show you a preview of your documentation. The "deploy" command then allows you to easily deploy the results out to a GitHub Pages location on the gh-pages branch. You can find out more about Couscous on the project website.

0 comments voice your opinion now!
documentation couscous tool markdown generate html output

Link: http://www.developerdrive.com/2014/12/simplify-your-documentation-process-with-couscous/

SitePoint PHP Blog:
Analyzing a PHP Project with Jenkins
December 05, 2014 @ 10:58:32

The SitePoint PHP blog has posted the latest part in their Jenkins+PHP series today. In this new article (the final part in the series) they use the Jenkins setup they've walked you through already and actually run the analysis on the PHP project and the resulting information.

The results of Jenkins come from different tools and will be placed in different locations within the Jenkins GUI. [...] Within this article, we will be going through each tool and have a look at what it reports back to us. In the end, we will also look at some extra details Jenkins collects for us. Since we build the same project several times, we will get straight lines within our graphs. In a real project, the graph would fluctuate.

He goes through some examples of the results from his analysis including screenshots and explanations for:

  • PHP_CodeSniffer
  • PHP MD (Mess Detector)
  • PHP CPD (Copy & Paste Detector)
  • PHP Depend
  • PHPLOC (Lines Of Code)
  • PHPUnit
  • PHPDox

He also briefly mentions the "changes" information, showing you what changed in that particular build to help narrow down any issues that might have come up.

0 comments voice your opinion now!
tutorial jenkins project analysis report output

Link: http://www.sitepoint.com/analyzing-php-project-jenkins/

SitePoint PHP Blog:
PHP Streaming and Output Buffering Explained
September 04, 2014 @ 10:17:44

The SitePoint PHP blog has a new performance-related post to the site today from Imran Latif. This new post looks at effective use of output buffering and streaming and explains how it works and some examples of its use.

As a PHP developer, I was wondering whether we can have something similar [to Streaming in Rails] in our favorite language? The answer is yes - we can easily have streaming in PHP applications with little effort, but in order to get this right we have to become familiar with some underlying concepts. In this article, we will see what streaming is, what output_buffering is and how to get our desired result under different webservers (Apache, Nginx) and PHP configurations (CGI, mod_php, FastCGI).

He starts off with a comparison of the two different methods, streaming and output buffering, and how they behave in the output of content. He then gets into some simple examples with PHP with various methods: a simple delay, chunking up output and finally using the actual output buffering handling PHP offers. He also includes an example of streaming content over an Ajax request with a simple test using the sleep function.

0 comments voice your opinion now!
streaming output buffering tutorial introduction beginner ajax

Link: http://www.sitepoint.com/php-streaming-output-buffering-explained/

Matthew Weier O'Phinney:
Testing Code That Emits Output
August 25, 2014 @ 09:45:08

In this latest post to his site Matthew Weier O'Phinney gives his suggestion on how to test (unit test) code that provides some kind of direct output. In his case, his script is outputting header information directly, not as a part of a response string.

Here's the scenario: you have code that will emit headers and content, for instance, a front controller. How do you test this? The answer is remarkably simple, but non-obvious: namespaces.

He talks some about the use of namespaces in PHP classes (and methods, and constants...) and how things can be importing using them. He gives an example of an object that outputs some header and body information (an "Output" abstract class). He shows how to use the class in a simple test, calling "reset" in the setup and teardown methods and asserting the contents of the headers and body for expected content.

0 comments voice your opinion now!
test unittest code phpunit output direct namespace tutorial

Link: http://mwop.net/blog/2014-08-11-testing-output-generating-code.html

SitePoint PHP Blog:
Fractal a Practical Walkthrough
August 06, 2014 @ 13:07:49

The SitePoint PHP blog has a new tutorial posted by Alexander Cogneau that gives you an introductory walkthrough of Fractal, a PHP-based library that provides a translation and presentation layer for the output of your APIs.

If you ever developed for an API, you might have had troubles with changes of your database schema. If you didn't happen to have a good implementation, you had to rework your whole model when changing some column names. In this article I will demonstrate how you can use Fractal as a layer between your models and JSON output. This post will show you how this package will make API development easier.

He walks you through getting the library installed (via Composer) along with Silex for the application handling and the Illuminate/database package from the Laravel framework. He also provides a SQL file to create the database for the application. The sample app handles music information, providing a simple song and artist list. It uses the Fractal package to transform the data using Transformer objects for each data type.

0 comments voice your opinion now!
fractal package tutorial introduction transform output api

Link: http://www.sitepoint.com/fractal-practical-walkthrough/

Lorna Mitchell:
Logging to Stdout with Monolog
June 09, 2014 @ 09:08:10

Lorna Mitchell has a quick post today showing how you can use the popular Monolog logging library to log messages and data to stdout, the standard output stream of whatever is executing the script.

My worker scripts have really basic logging (as in, they echo when something happens, and I can see those in the supervisord logs). Which is kind of okay, but I wanted to at least add timestamps in to them, and maybe send emails when something REALLY bad happened. I'm a huge fan of Monolog so I grabbed that, but it wasn't immediately obvious which of the many and varied options I would need for this fairly simple addition. It turns out that the right thing to use is the ErrorLogHandler.

She includes a few lines of sample code that use the "ErrorLogger" to output the message. It includes the log level, a timestamp, the message itself and any additional contextual information you pass in.

0 comments voice your opinion now!
monolog stdout output example library logging

Link: http://www.lornajane.net/posts/2014/logging-to-stdout-with-monolog

Evert Pot:
jCard is now a thing
January 21, 2014 @ 11:04:18

In his most recent post Evert Pot talks about jCard, a JSON-based format that was recently approved to serve up VCard personal information data in an easier-to-parse format.

I'm a big fan of this format. vCards have been around since 1995, and even though we've had a pretty significant update in 2011 in the form of vCard 4.0, the format is still complicated to parse, has a number of problems that go all the way back to the early days. [...] The biggest problem with vCards, is that upon a first glance, the format seems extremely easy to parse and generate with just a couple of string manipulation functions. When you dig deeper into the specifications though, you'll notice that it's actually really complex and hosts a ton of edge cases.

He includes an example of how to generate the jCard format using the Sabre/Object and the resulting output, both in the traditional vCard format and the new jCard structure.

0 comments voice your opinion now!
vcard jcard json format sabre object parse output

Link: http://evertpot.com/jcard-completed

Sameer Borate:
Easy PHP debugging with Kint
November 07, 2013 @ 11:24:02

Sameer Borate has posted about using Kint, a "more powerful debugger" that lets you output more data than just the usual var_dump or print_r provides and in a much more readable format.

My standard debugging tool when using PHP is xdebug. Pairing xdebug with Komodo gives me a very productive environment for building PHP applications. However, testing an application code on a hosted server can be many times frustrating as one has only the print_r and var_dump functions at our disposal. What I need is a library that I can easily install on the server and start using. Although there are a few debugging libraries around, one of my favorites is Kint.

He walks you through the installation of the tool and provides an example of the most basic usage (and output) from a call to the tool's "dump" function. He also gets into some of the additional features the library provides including intelligent formatting, debug tracing and limited theme configuration.

0 comments voice your opinion now!
debug kint output printr vardump example setup

Link: http://www.codediesel.com/tools/easy-php-debugging-with-kint/

Phil Sturgeon:
Named Parameters in PHP
September 02, 2013 @ 10:52:40

in a new post to his site Phil Sturgeon talks about a new (old?) proposal to introduce named parameters into PHP.

Named Parameters for PHP is not a new conversation. It's reared its head several times - so much so that the named parameters RFC says: "Since the topic continually gets re-raised, and now PHP has an RFC process, the discussion should be recorded in an RFC (Note this is yet to be done) so the same arguments don't have to be revisited."

He notes the negative attitude that seems to currently be shown in the RFC and has made the offer to rewrite it to be more impartial to the subject at hand. In the comments of the post there's also some feedback about the different syntaxes and varying levels of support for the proposal.

0 comments voice your opinion now!
named parameter language feature rfc rewrite

Link: http://philsturgeon.co.uk/blog/2013/09/named-parameters-in-php

MaltBlue.com:
Basic CSV Output in Zend Framework 2
July 18, 2013 @ 09:20:42

Matthew Setter has a new post on the MaltBlue site about creating CVS output from a Zend Framework 2 based application. Instead of writing to a CSV file on the local file system, he opts to push the information out to the user directly in the browser.

Today's tutorial is a simple one. We're going to look at a simple way of rendering CSV output in Zend Framework 2 using a combination of a View Template and Controller Action. We're going to see just how easy it is to generate content and send it to the browser, instead of rendering a standard .pthml template.

He includes the module configuration that sets up the location of the CSV template file and defines the "download/download-csv" header. The view template is pretty simple - just a loop of the results that calls fputcsv to push the data info a file handle. The code for the controller is also included, showing how to create a view model to push the data out.

0 comments voice your opinion now!
cvs output zendframework2 tutorial viewmodel

Link: http://www.maltblue.com/tutorial/simple-csv-output-in-zend-framework-2


Community Events





Don't see your event here?
Let us know!


laravel community interview version tool podcast composer opinion language series artisanfiles release list framework conference voicesoftheelephpant security library introduction symfony

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework