News Feed

News Archive
feed this:

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

SitePoint PHP Blog:
Effective PDF Generation in Drupal
February 03, 2015 @ 09:43:53

On the SitePoint PHP blog today there's a new post showing you how to create PDFs in a Drupal-based site making use of the Print module for the creation and formatting.

DF generation takes a slight change of mindset. As web developers, we have spent a lot of time convincing designers from a print background to stop producing pixel perfect designs that will be difficult to reproduce on the web. If you want to introduce PDF generation or any form of high designed print output, then we need to relearn some of our old skills we left behind. The nature of print means that it is precise and often needs pixel (or millimeter) perfect design.

He'd initially thought that the Views PDF module would be the natural choice, but after finding some unwanted dependencies, opted for the Print module instead. The Print module only creates the formatted output, though. This is then passed off to wkhtmltopdf to convert into final PDF form. He walks you through the configuration for the Print module and how to create some of the basic HTML structure for the resulting output. Next up is the addition of some styling and the process for exporting the HTML output over to wkhtmltopdf for handling. Output samples are included to help illustrate the final result.

0 comments voice your opinion now!
pdf generation drupal tutorial views print wkhtmltopdf convert

PHP Next Generation
May 28, 2014 @ 09:14:05

On the main site today there's an announcement posted about the working being done on the next generation of the PHP language based on some recent discussions (and actual development work). The PHPNG branch helps boost the performance of the language to new levels and cleans up some of the core APIs.

When we aren't looking for pictures of kittens on the internet, internals developers are nearly always looking for ways to improve PHP, a few developers have a focus on performance. Over the last year, some research into the possibility of introducing JIT compilation capabilities to PHP has been conducted. During this research, the realization was made that in order to achieve optimal performance from PHP, some internal API's should be changed. This necessitated the birth of the phpng branch, initially authored by Dmitry Stogov, Xinchen Hui, and Nikita Popov.

The post talks about the performance increase of these changes (an average of 20%) and the current progress made on the internal project. This is "only the start" of the work on this new functionality, so keep an eye on the site for more upcoming details.

0 comments voice your opinion now!
phpng next generation branch project performance


Timoh's Blog:
Secure random numbers for PHP developers
November 06, 2013 @ 09:20:55

Timoh has posted a look at random number generation to his site, focusing on one of the many methods to produce truly random number - using /dev/(u)random (available on Unix-based filesystems).

How would you gather cryptographically secure random bytes in your PHP application? This is actually quite a good question. It used to be, and seems, it still is not that uncommon to just simply call mt_rand() function to get the job done creating user's "initial password", for example. A bit more experienced reader will notice there is a security bug. [...] But actually only a few [functions to get random values] can be recommended for security sensitive purposes. And now I'm not talking about openssl_random_pseudo_bytes().

He starts with a look at openssl_random_pseudo_bytes and why there might be something wrong with its use - mainly that OpenSSL has had its own share of security issues in the past. Of the two random resources he recommends /dev/urandom as it's less blocking and more useful for web applications. He recommends the RandomCompat library if you need to take this random data and transform it into integers (with one caveat).

0 comments voice your opinion now!
secure random number generation devurandom urandom openssl


Anthony Ferrara:
Preventing CSRF Attacks
February 20, 2013 @ 09:36:41

Anthony Ferrara has written up a new post to his site looking at efective use of CSRF tokens and a few different strategies for generating them.

There's been a bit of noise in the past week about the proper way to prevent Cross-Site-Request-Forgery (CSRF) attacks. It seemed to have started with this post. There's been discussion in the comments, and on Twitter about it, and there seems to be several opposing viewpoints on the matter. I want to start off by saying that I agree completely with the post in question. But I figured I'd write a post to explain WHY I agree with it.

He starts with an overview of a few of the common types of request forgery including from a javascript injection, a Man-in-the-Middle attack and a replay attack. He then breaks up the "lines of defense" part of the post into three different sections - adding a hidden token field to forms, changing the token for each request and using random numbers when regenrating them.

0 comments voice your opinion now!
csrf attack prevention overview token generation tutorial
Simplifying Test Data Generation with Faker
February 19, 2013 @ 12:09:02

In a new post to today, Rakhitha Nimesh takes a look at Faker, a tool that can be used to generate random test case data as a part of your workflow.

Testing is an iterative part of the development process that we carry out to ensure the quality of our code. A large portion of this entails writing test cases and testing each unit of our application using random test data. Actual data for our application comes in when we release it to production, but during the development process we need fake data similar to real data for testing purposes. The popular open source library Faker provides us with the ability to generate different data suitable for a wide range of scenarios.

Faker uses built-in data providers like "Person", "Company", "DateTime" and "UserAgent" to give you randomized output from the data sets you define. Code is included showing how to create the provider in your objects, extending the correct provider and making a request for a property. A real-world example is also included about testing an email marketing engine for address, title, name and content. There's also a little bit added at the end showing how you can increase the randomness of the results returned by "seeding" the Faker engine.

0 comments voice your opinion now!
test data generation faker library object provider tutorial

Kevin Schroeder:
Generating secure cross site request forgery tokens (csrf)
February 11, 2013 @ 11:23:10

In this new post to his site Kevin Schroeder has a new post with his take on generating more secure CSRF tokens for use in your site.

In researching the second edition for the IBM i Programmer's Guide to PHP Jeff and I decided to include a chapter on security since we really didn't talk much about it in the first edition. I'm talking about cross site request forgeries right now and I wanted to make sure that what I was going to suggest would not break the internet in some way. I did some Google searching to see what other people were recommending.

Most of the examples he saw used md5, uniqid and rand to create a randomized hash. He suggests an alternative - a method using the hash_hmac and openssl_random_pseudo_bytes methods to generate a sha256 hash for use in your page's submissions.

0 comments voice your opinion now!
csrf token generation hmac openssl
Zend Form Mastery with Zend_Config - Part 2, Core Form Configuration
May 15, 2012 @ 11:04:01

In his previous post to the blog Matt introduced the concept of configuration-driven Zend_Form instances. He's back with a second part to the series, enhancing his original examples by covering some of the base-level form configuration settings.

Ok, this should have been part one, but irrespective, here's the second installment in zend form mastery with zend config - core form configuration. As the W3c Form spec says, there are 8 attributes applicable to forms.

These attributes, including "action", "name" and "onsubmit", can all be set easily in the XML-based configuration file. He includes an example of the full XML file to show how they all fit together (updated from part 1). You can see an example of the output here and can grab the source for the example from github.

0 comments voice your opinion now!
zendframework zendconfig zendform generation xml tutorial
Easy Form Generation Using FuelPHP
March 14, 2012 @ 10:05:17

On the site today there's a new tutorial from Sahan Lakshitha about creating forms in FuelPHP, the PHP 5.3-centric framework.

Thanks to FuelPHP's fieldset class, working with forms couldn't be easier. With a few lines of code, you can easily generate and validate a form. Today, we're going to learn how to do just that!

He starts with guiding you through a simple install of the FuelPHP framework and configuring it to connect to a MySQL database. He shows how to set up a model, specify its properties and creating a controller to handle the user interaction. Using the definitions in the model, FuelPHP can automatically generate a form, complete with default options and some validation on the field (things like "required", "valid_url" and "max_length"). There's also code included showing how to edit current posts and listing out the complete post list.

0 comments voice your opinion now!
form generation fuelphp tutorial fieldset framework
New User Guide in Development
October 06, 2011 @ 09:55:48

The CodeIgniter development team is happy to announce work that's been done on the framework's user guide to help make it even better and easier to find the information you're looking for (now based on the Sphinx documentation generation engine).

In addition to handling the tedium of generating page and document tables of contents, or maintaining internal links and references, the documentation is now easier to write, as you can simply focus on the content instead of markup and presentation. Don't forget syntax highlighting of PHP, HTML, CSS, and JavaScript in code samples. Based on ReStructured Text, it's also more human readable in a text editor than HTML is, which is likely where you spend most of your time. As an added benefit, Sphinx can output HTML, PDF, and even EPUB formats all from the same source files.

There's also been a style redesign in the latest release (here on github) on the development branch of the framework. They warn of a few "bumps" that you might come across in using it, but they're working hard to take care of those quickly. If you'd like to see the new version, check out the nightly build results.

0 comments voice your opinion now!
usergruide development sphinx markup generation framework codeigniter

Zend Framework Google Analytics Code Generation
August 24, 2011 @ 09:46:58

Martin Aarhof has put together an handy tool for Zend Framework applications that creates the async javascript analytic code recommended by Google to provide tracking information back to Analytics.

It supports: browser Settings Detection, campaign Duration, campaign Fields (custom), cross-domain linking and last but not least Ecommerce tracking.

The configuration lets you set the various keys for your Analytics accounts, the domain name for it to live under, browser detection settings and various other settings for campaign configuration and domain setup. You can find the full code on his github account ready to download or clone.

0 comments voice your opinion now!
project code generation google analytics javascript campaign domain configuration

Community Events

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

podcast threedevsandamaybe extension laravel5 interview language version opinion symfony library framework unittest voicesoftheelephpant api laravel security release series community introduction

All content copyright, 2015 :: - Powered by the Solar PHP Framework