News Feed
Jobs Feed
Sections




News Archive
feed this:

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

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

[php]architect:
Returning to Print!
October 16, 2013 @ 09:29:06

[php]architect magazine has made a big announcement today in response to one major request they've received - the magazine is once again available in a print version!

"Are you going to bring the magazine back to print?" It's the #1 question on everyone's minds. Since musketeers.me first acquired php[architect] at the beginning of 2013, it is the one question that we have constantly been asked. While digital publishing is the future, people still love the feeling of having a printed magazine in hand.

Knowing that our customers wanted it, we've worked hard to figure out a way that we could bring the magazine back to print again. We are extremely excited today to announce that starting with the November 2013 issue, php[architect] will once again be printed!

The print subscription will come in at $119 USD for a year's worth of magazines. They've also updated all current customers to a combined Digital level that includes all three major formats (PDF, ePub and Mobi). You can get more information about your current subscription level by logging in or, if you want to sign up now, check out the subscription information.

0 comments voice your opinion now!
print version phparchitect magazine subscribe digital format

Link: http://www.phparch.com/2013/10/returning-to-print/

Derick Rethans:
ISO 8601 week dates
September 24, 2013 @ 09:54:31

Derick Rethans has a new post with details about handling ISO 8601 dates in PHP via the DateTime functionality. It's a response to some bugs filed having to do with week numbering.

Week numbers are defined in this same ISO 8601 standard. Each year has 52 or 53 weeks and weeks always start on a Monday. Week number 1 of each year is the first week in a year that has the first Thursday of the year, or in other words, the week containing January 4th.

He talks about some of the date format arguments that use would use when working with the ISO 8601 formatting and how it relates to the calendar year. He points out that the "Y" format specifier is not the same as the "o" - the first being the calendar year while the second relates to the ISO 8601 year.

As conclusion, this article shows that there are two ways representing dates in PHP. In the Gregorian1 calendar with year, month and day (of month), and in the ISO 8601 calendar with year, week and day (of week). The format characters for the two different years are either Y or o and they should not be confused.
0 comments voice your opinion now!
iso8601 date datetime format specifier gregorian calendar difference

Link: http://derickrethans.nl/iso-8601-weeks.html

Phil Sturgeon:
Why PHP DateTime Rocks
August 02, 2012 @ 11:41:29

Phil Sturgeon has a new post sharing some of his thoughts on why DateTime rocks, the advanced functionality that PHP has to work with dates, times, timezones, etc.

DateTime is nothing new, but it's definitely under-used by many. It was made available in PHP 5.2.0 but got some of its best features until PHP 5.3.0. PHP 5.3.0 is pretty old now, but I learned about DateFormat::createFromFormat() after reading a new addition to PHP The Right Way: Date and Time.

He shares to "offender" examples where using this function allowed him to simplify and reduce the amount of code needed to handle the formatting of a date into a MySQL format and calculating the difference between two time values.

0 comments voice your opinion now!
datetime example mysql data format createfromformat


Bob Majdak:
Apache access logging in JSON format
July 26, 2012 @ 11:42:02

Bob Majdak has a quick new post to his site showing you how to log messages to Apache using a JSON format instead of the usual single-line information.

So this past week I have been doing a lot of logging, parsing, and graphing. I was sitting there wondering what I could do to make the Apache access logs easier to work with. Then it hit me, a brilliant stroke of win: why not format it in JSON? Then in my log parser I could just json_decode it! As far as I know there are no tricks to make Apache do this for you, so really all we have to do is define a custom log format that happens to look like JSON.

He includes the "LogFormat" line you'll need to add to your Apache configuration to make it log the JSON and a bit of PHP to help you pull in the file's contents and parse each line.

0 comments voice your opinion now!
json apache log format logformat jsondecode


PHPMaster.com:
Working with Dates and Times in PHP and MySQL
March 01, 2012 @ 08:51:47

On PHPMaster.com today there's a new tutorial by Sean Hudgston about working with dates and times via the PHP date functions and how they cooperate with dates/times from a MySQL database.

When working in any programming language, dealing with dates and time is often a trivial and simple task. That is, until time zones have to be supported. Fortunately, PHP has one of the most potent set of date/time tools that help you deal with all sorts of time-related issues: Unix timestamps, formatting dates for human consumption, displaying times with time zones, the difference between now and the second Tuesday of next month, etc. In this article I'll introduce you to the basics of PHP's time functions (time(), mktime(), and date()) and their object-oriented counterparts, and then take a look at MySQL dates and show you how to make them play nicely with PHP.

His examples include how to get the current Unix time, formatting dates/times, making timestamps and working with the more powerful DateTime objects. On the MySQL front, he shows the result of a normal date select, one using the "unix_timestamp" function and how to shift the result based on the user's timezone.

0 comments voice your opinion now!
date time mysql datetime tutorial format unix timestamp


php|architect:
Seeing Triple!
March 03, 2011 @ 10:05:47

php|architect Magazine has officially announced the introduction of a new publishing format for their magazine. Readers are no longer tied to just PDF versions - they can now opt for ePUB editions of the magazine starting with this month's issue (and retroactively!).

Still, even though PDF was a less popular format in 2002 than it has become today, it was a much easier choice for us when the only way to read an electronic publication was to sit in front of a computer. The advent of portable e-book readers demanded that we consider other formats; as a result, about six months ago we started a skunkworks program, spearheaded by our very own Keith Casey, to create ePub and MOBI versions of our magazine.

Thanks to an ePUB document generator, the magazine can now be dynamically generated into three formats - the usual PDF file, an ePUB edition and a MOBI edition for the Kindle fans out there. All subscribers have been upgraded to this plan - the Premium subscription - and are able to start pulling down these editions today.

1 comment voice your opinion now!
publishing format phparchitect pdf epub mobi


Volker Dusch's Blog:
Creating your custom PHPUnit output formats
January 20, 2011 @ 08:36:00

Volker Dusch has a new post to his blog today talking about PHPUnit and how you can make custom output formats to get the results exactly how you need them. The trick is in using XSLT for transformation.

While tackling with someones question i decided it's time to play around with xslt for learning purposes and i found something useful to do. He wanted to extend the --testdox-html output and i proposed to just transform phpunits xml output using an xslt since i didn't see a easy way to prove a custom implemenation for PHPUnit/Util/TestDox/ResultPrinter/HTML.php and i didn't want to change the file its self.

He gives an example of how to use the textdox output method to generate an XML document of the unit test run's results and a simple XSLT style sheet to format the results as a custom HTML page. He uses the "xsltproc" command line tool to make the translation happen.

0 comments voice your opinion now!
phpunit textdox xml xslt convert output format


Rob Allen's Blog:
Validating dates
November 09, 2010 @ 12:11:12

In a new Zend Framework related post to his blog today Rob Allen takes a look at a different operating mode he found with Zend_Date changing how it handles format specifiers.

I discovered recently that Zend Framework 1's Zend_Date has two operating modes when it comes to format specifiers: iso and php, where iso is the default. When using Zend_Validate_Date in forms, I like to use the php format specifiers as they are what I'm used to and so can easily know what they mean when reviewing code that I wrote months ago.

His example code shows how you can use the standard date formatting strings in a Zend_Form validator (the "php" format) and an example using the Zend_Date::MONTH or Zend_Date::YEAR identifiers (the "iso" format). He also shows how he met two other requirements - validation for empty and a consistent format on the date validation ("Y-m-d").

0 comments voice your opinion now!
validate date zendform zendframework iso format


Brian Swan's Blog:
Rendering SQL Server Reports as Excel Documents with PHP
September 27, 2010 @ 10:15:51

Brian Swan has a new post to his blog that looks at a method for pulling back the reports from a SQL Server instance in something a bit more readable/useful - an Excel document.

One of the most common questions [from his previous post] has been "How do I render a report as an Excel document?" I've been telling folks that this is easy with the SSRS SDK for PHP (and it is easy), but when I sat down to do it, I ran into a problem. So, in this post, I'll show you how to render a SSRS report as an Excel document and how to avoid the one problem that caused me headaches.

This post's a short one with a code snippet (and download) showing how to connect to the server and create a "RenderAsEXCEL" object and request the report information with that in the rendering function. Then it's just as simple as pushing that information out to a file as a ".xls". The included download will also let you pull down the report as HTML or as a PDF.

0 comments voice your opinion now!
sqlserver report excel format pdf html



Community Events











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


hack support security overview release unittest package symfony2 facebook language hhvm opinion framework component podcast application composer code install introduction

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