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

PHPMaster.com:
Saving PHP Sessions in Redis
July 09, 2013 @ 10:53:01

On PHPMaster.com today there's a new tutorial showing you how to store your application's sessions in Redis, a key/value store known for its flexible nature and speed.

PHP's default handling of session data is probably sufficient for most applications, but sometimes a project will demand a different storage approach. Luckily, the session handling routines can be overridden either by a series of functions (in older versions of PHP) or a class with methods (in newer versions) which handle various aspects of session management. In this article we'll learn how to create a custom session handler which implements PHP's SessionHandlerInterface interface and stores the session data in a Redis database.

He talks some about the reasoning behind using something more than just the normal PHP session handling (including the flexibility it provides). He covers some of the basics of the session handling functionality and covers how the data itself is stored. Finally, he gets to the actual class - a Redis-specific handler that implements the SessionHandlerInterface interface.

0 comments voice your opinion now!
tutorial redis session storage save introduction

Link: http://phpmaster.com/saving-php-sessions-in-redis/

PHPWomen.org:
Add values to a symfony form in between save() and serialization to the database
October 05, 2012 @ 08:55:12

Kim Rowan has recently posted this helpful hint to the PHPWomen.org site concerning the addition of values between save/serialization in Symfony (1.4) forms.

OK, I have a Comment model and I want to relate Comment objects to several other different model types. So, I need to be able to persist Comment objects in my database that relate to the author of the comment and one of a handful of other tables, for example, a blog post or a licence record, etc.

She includes the contents of her "schema.yml" definition and the code to create and display a basic form. Inside of her "executeCreate", the form's submission is handled and a "processForm" method is called and the overridden "updateObject " is used to inject the new data (a user ID) into the submission.

0 comments voice your opinion now!
symfony form tutorial override save object inject data


DZone.com:
Sencha Touch 2 Models - Loading And Saving Model Data Using a Proxy, PHP Example
August 31, 2012 @ 11:54:19

On DZone.com there's a new tutorial posted (by Jorge Ramon) about hooking together the models of Sencha's Touch 2 with a PHP backend to make saving data to them simpler via a proxy.

Sencha Touch models have the ability to work with a proxy. This feature allows you to save and retrieve model data from the server, memory or local storage, without depending on a Sencha Touch data store. Let's try it with a very simple scenario where the server side is a PHP page.

The article includes both the Javascript to create the models (along with its proxy and custom API methods defined) as well as the PHP that powers the backend. The PHP just reads from the "php://input" stream and echoes back out JSON, but it gives you an idea of what to expect to receive. For more information on Sencha Touch, check out their documentation.

0 comments voice your opinion now!
senchatouch2 model backend save proxy tutorial


Robert Basic's Blog:
A Zend Framework 2 EventManager use case
October 20, 2011 @ 11:05:43

Robert Basic has a new post to his blog today with an use case for Zend Framework 2's event manager to solve a problem he has with "repetitive code" in some of his models.

Basically, this allows us to have one piece of code to trigger an event and to have one or more listeners listening to this event. When the event gets triggered, the listeners are called and then we can do *something*, like caching or logging. Logging or caching. [...] See, that's my problem. All the event examples stop at logging and caching. Truly there must be some other example for which this event stuff can be used for.

In his example code, he's used the EventManager in one of his models to add listeners to validate the post and "slugify" the post's title for use on the URL. You can find his code on github if you're interested in the full implementation.

0 comments voice your opinion now!
zendframework eventmanager usecase model listener save


Volker Dusch's Blog:
Running your Unittests everytime you save a file
December 23, 2010 @ 11:55:23

Volker Dusch has a suggestion for all of those developers out there really concerned about the quality of your code - consider running your unit tests every time you save a file with the help of a tool called PyWatch.

At the moment he placed the Idea in my head that i want my testsuite to run every time a file changes anyway, let someone else figure out how that is triggered. Well, someone did figure that out, thank you. It's called "PyWatch" and is a simple python script that monitors files for changes and executes a script if one has changed.

Obviously you wouldn't want to keep this going for larger code bases (the potential for overlap is horrible) but it could be quite useful when doing test-driven development to save yourself some hassle at the outset. He includes the commands you'll need to get things running and a simple PHP script that points the PyWatch instance to the correct files.

2 comments voice your opinion now!
unittest pywatch save file phpunit codecoverage


Hasin Hayder's Blog:
Using new PECL Memcached extension for storing session data
October 19, 2009 @ 09:51:21

Hasin Hayder has a new post talking about the new memcached extension for PHP (memcached from PECL) and how it can be used to store sessions data.

Many of you already know that managing session is a critical task for web applications, specially when you want to avoid I/O hop and also a significant load over your database by writing a custom session handler. [...] This is why a central session manager is very important for your application to scale.

He walks you through the whole process - installation, setting up memcached instances and getting the extension installed and working with your PHP installation. By adding two lines to your php.ini file, the sessions can quickly and easily be stored in memcache instead of on the local server.

0 comments voice your opinion now!
session data save memcached pecl extension


Vinu Thomas' Blog:
Saving Data into Excel the Easy Way using PHP
July 02, 2009 @ 10:18:51

Vinu Thomas has a new post to his blog looking at using the MS-Excel Stream Handler class to push your data out to Excel (in more than just a CSV file).

If you're looking for an easy way to output your data from a PHP script into a Excel file, you've got to check out this script which I came across at the PHP Classes site. What this script essentially does is to implement a stream handler interface to write Microsoft Excel spreadsheet files.

Code snippets are included showing how to structure the data for the import and how to push that generated Excel file out to the user's waiting client.

0 comments voice your opinion now!
class excel save


Maarten Balliauw's Blog:
Saving a PHPExcel spreadsheet to Google Documents
February 03, 2009 @ 12:58:56

Maarten Balliauw has written up a guide to saving the output of your PHPExcel applications out to the Documents service that Google offers.

As you may know, PHPExcel is built using an extensible model, supporting different input and output formats. The PHPExcel core class library features a spreadsheet engine, which is supported by IReader and IWriter instances used for reading and writing a spreadsheet to/from a file. Currently, PHPExcel supports writers for Excel2007, Excel5 (Excel 97+), CSV, HTML and PDF. Wouldnt it be nice if we could use PHPExcel to store a spreadsheet on Google Documents? Let's combine some technologies.

The two technologies in question are a standard install of the PHPExcel library and the Zend Framework (with its Zend_Gdata component). Using the component, a save() method is created and hooked into the IWriter interface of PHPExcel. When this save method is called, the Zend_Gdata component connects to the Documents service and uploads the resulting information for the account you supply.

0 comments voice your opinion now!
tutorial save phpexcel extensible document google spreadsheet zendframework zendgdata


CSSGallery.info:
Textmate - php syntax check
January 27, 2009 @ 12:55:22

If you're a fan of the Textmate editor for the Mac platform, you might want to check out this new post from the cssgallery website. It shows how you can get your favorite editor to check your PHP syntax for you.

A nice "hidden" feature that Textmate has, is to check the syntax of the php files you are writing, and display a popup with the result. [...] Each time you save, a syntax check will be done, and a popup will show you the result

You'll need to edit the PHP bundle slightly to get things working, but that's as easy as going through the UI and changing a drop-down value to activate the check. You'll need to have a php binary where the editor can use it, but most OS X installs will have that in place anyway. Check out this image to see the end result.

0 comments voice your opinion now!
textmate editor bundle edit syntax check save


Ask Apache Blog:
A better way to use PDF files online
November 26, 2007 @ 11:11:00

From the Ask Apache blog, there's a quick tip that makes it simple to give your site's visitors the option to either download or view a PDF file no matter what their browser default is.

One of the most annoying things on the Internet for me is when I click on a link to an Adobe PDF file. For me this is annoying to the extreme because the PDF file is openened directly in your browser because of the Adobe PDF Plugin that almost all browsers have installed. [...] For me an ideal solution would be to offer me choices.

His solution uses mod_rewrite in an .htaccess file to push the visitor to a PHP file. This file grabs the filename they want and pulls in the content, pushing it back out the other side with the "attachment" header that forces a request box on the browser.

0 comments voice your opinion now!
pdf file modrewrite htaccess save open choice pdf file modrewrite htaccess save open choice



Community Events





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


release code developer testing unittest threedevsandamaybe laravel podcast list introduction wordpress refactor language opinion configure series install community interview framework

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