2011年11月30日星期三

Community News: Latest Releases from PHPClasses.org

PHP.net: PHP 5.4 RC2 released


The PHP.net site has officially announced the availability of the latest Release Candidate for the PHP 5.4.x series - PHP 5.4 RC2:



The PHP development team is proud to announce the second release candidate of PHP 5.4. PHP 5.4 includes new language features and removes several legacy (deprecated) behaviours. Windows binaries can be downloaded from the Windows QA site. THIS IS A RELEASE CANDIDATE - DO NOT USE IT IN PRODUCTION!. This is the second release candidate. The release candidate phase is intended as a period of bug fixing prior to the stable release. No new features should be included before the final version of PHP 5.4.0.


Fixes in this new version include updates to the built-in web server, PHP-FPM no longer being marked as experimental and changes to the Zend Engine, Core and various extensions. See the NEWS file for complete details. You can download this latest release from the downloads page (and here for Windows users).

Community News: Zagreb PHP User Group December 2011 Meeting - 13th @ 6pm


Miro has submitted some information about the latest meeting of the Zagreb PHP User Group happening December 13th at 6pm in the Multimedia Institute:




Although Zagreb PHP Meetup started only 3 months ago with monthly meetups (up to 30 developers coming), our next meeting will be first meetup with organized talks. December meetup will have 5 talks with themes like 'How to write readable code?', 'Flex & PHP development' , 'Introduction to test driven development' && 'MySQL - explain explained'.



We would like to invite all interested PHP and non-PHP developers that would like to listen to some of best Croatian PHP devs (and understand Croatian language) to come on December 13th from 6PM to Mama, Preradoviceva 18 in Zagreb. Unfortunately we are limited with number of available seats so please signup at http://zgphp.eventbrite.com/.




Due to space limitations, there's only 12 seats available so hurry and reserve your spot if you'd like to attend (it's free)!



Have a user group meeting you'd like announced? Let us know!

2011年11月29日星期二

Community News: Latest PECL Releases for 11.29.2011

Latest PECL Releases:

Brian Swan's Blog: The SQL Server ODBC Driver for Linux is Available!


As Brian Swan has mentioned in his latest blog post, the ODBC database driver for SQL Server on Linux has been released. This is a huge step forward for directly connecting linux-based systems (and programming languages) to this popular Microsoft product.



The first beta release of the SQL Server ODBC Driver for Linux is available for download! As announced in October, the "Multiplatform Team" (a.k.a. the "MPlat Team") has released a preview version of a driver that will provide first-class access to SQL Server from applications running on Linux operating systems. The team is looking for feedback on this release to incorporate into their production-ready release, so try it out and let us know what you think.


He links to a few resources about the release - more details, a link to download the driver and the official documentation.

PHPMaster.com: Introduction to Git, Part 1


If you haven't gotten a chance to try out git for your version control system, now's the perfect time. PHPMaster has an introduction to using git for a simple PHP project. It introduces you to some of the basics and gets you up to speed quickly.



Some of the more commonly used version control systems that you have likely heard about are CVS and Subversion. This tutorial will take a "forget everything you know about CVS or Subversion" approach. As someone who has used all three of these systems in the professional realm, I can testify that some knowledge of CVS or Subversion can be useful when approaching Git, but it is not necessary. The best way to learn Git is to start using Git for what Git is.


They break it up into a few different sections - why use git, how to create a new repository, adding/staging files for commit, viewing the project history and viewing diffs for different versions. This is the first part in a series, so keep tuned for future parts touching on branching, merging and working with remote repositories.

2011年11月28日星期一

Gonzalo Ayuso's Blog: Playing with the new PHP5.4 features


Gonzalo Ayuso has a new post to his blog today showing some of the experimentation he's done with PHP 5.4 features like the short array syntax, calling methods through arrays and traits.



PHP5.4 it's close and it's time to start playing with the new cool features. I've created a new Virtual Machine to play with the new features available within PHP5.4. I wrote a post with the most exciting features (at least for me) when I saw the feature list in the alpha version. Now the Release Candidate is with us, so it's the time of start playing with them. I also discover really cool features that I pass over in my first review.

Code snippets are included for each example for:



  • Class member access on instantiation
  • Short array syntax
  • Support for Class::{expr}() syntax
  • Indirect method call through array
  • Callable typehint
  • Traits
  • Array dereferencing support


He points to this other post for a complete list of what's been added in 5.4.

2011年11月24日星期四

Engine Yard: The Future of PHP: PEAR and Pyrus Webcast Recording


If you missed out on the Future of PEAR/Pyrus webcast event put on by Engine Yard, you're in luck - they've posted a recording of the event.



In this panel discussion, we tackle topics including the direction PEAR and Pyrus will be going in the next few years, obstacles that may be on the horizon, and more.


PEAR is the package library of standardized packages for a variety of common development tasks. Pyrus is a new package manager to make installing and maintaining PEAR packages simpler. Engine Yard's next webcast will cover the Lithium framework with core contributors Nate Abele, Garrett Woodworth, and John Anderson on December 1st.

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

2011年11月23日星期三

Lorna Mitchell's Blog: POSTing JSON Data With PHP cURL


On her blog today Lorna Mitchell has a quick tip for anyone having an issue sending POSTed JSON data with the curl functionality that can be built into PHP. The trick to her method is sending things with the right header.



We can't send post fields, because we want to send JSON, not pretend to be a form (the merits of an API which accepts POST requests with data in form-format is an interesting debate). Instead, we create the correct JSON data, set that as the body of the POST request, and also set the headers correctly so that the server that receives this request will understand what we sent.


She includes a code example (about ten lines) showing the POSTing process that sets up options using curl's curl_setopt. Be sure to set up the headers to send as "application/json" - that's the trick to letting the remote end know the format.

Community News: Latest Releases from PHPClasses.org

2011年11月18日星期五

Site News: Popular Posts for the Week of 11.18.2011

Popular posts from PHPDeveloper.org for the past week:

DZone.com: Creating a virtual server with Vagrant: a practical walkthrough


On DZone.com there's a new post from Giorgio Sironi looking at how to automate a build of a virtual server with Vagrant, setting up a LAMP-based development instance.



Vagrant ia a tool for building virtual machines (in VirtualBox's format) that conforms to a specification. It's written in Ruby, but it makes really no assumptions over the environments that you're gonna build; in this article, we will setup a virtual server for PHP applications running inside Apache.


The end result is a virtual machine based on VirtualBox images and can be built in a few easy steps:



  • install the vagrant gems on the build system
  • add a new virtual box instance pointed to a .box file
  • create the Vagrant config (including the commands to run post-create)
  • set up a little port forawrding
  • creating a phpinfo file and starting up Apache


One suggested place for grabbing images (some with pre-defined software) is Bitnami's "Stacks" repository.

DevShed: Building an ORM in PHP


On DevShed today there's a new tutorial showing you how to build a basic ORM layer on top of a MySQL database. It includes all the code you'll need (cut&paste-able, not as a download).



Obviously, with so many ORMs at one's disposal for free, it seems pretty pointless to develop a custom one; are we trying to reinvent the wheel? No, of course not. But if you need to create a simple application that performs a few CRUD operations on some related domain objects and don't want to climb the learning curve of a third-party library, then implementing a custom ORM might make sense. There's alos the educational aspect of the process (yes, learning one or two things never hurts).


They start you off with the creation of the "data persistence layer" (an interface first) to connect to the database, building a MySQL-specific one on top of it. Next up is the data mapper layer making things like "fetch by ID" and the insert/update/delete possible. Their simple example doesn't include anything about ORM relationships, though - just fetching simple rows.

2011年11月17日星期四

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

SitePoint.com: Software Development? We're Doing it Wrong.


On SitePoint today there's a new post from Eran Galperin (of Binpress) about how, if you're jumping immediately to custom software development, you're probably doing it wrong.



Code reuse is largely accepted as "best practice" in our industry. Code reuse has many advantages, such as a smaller code-base which is easier to grok for developers. It's easier to maintain and optimize, since you can make less changes in order to achieve the desired results. Many modern techniques and tools were created in order to better reuse and modularize code. But while we're reusing code, we're duplicating effort. The same code is being written over and over in different places, wasting time and money.


He suggests that custom development should always be a last resort for software development, that there's plenty of other (open source) software out there that meets many of the needs businesses have. In his opinion, component-based development is the future of the industry - pieces that fit together with common interfaces and are larger than the sum of their parts. He sees a "commercial open source" model emerging from the current state of things. This model could result in more well maintained OS projects and more functionality being released as a part of it.



What we have currently is increasing noise, as more and more people have easier access to start programming and publishing their projects. We need to streamline the process and add that missing financial element that makes it sustainable and repeatable.

Symfony Blog: SensioLabs Connect, a week later


On the Symfony Blog today they have an update on their latest community offering, SensioLabs Connect, a service connecting Symfony developers all around the world. It's been one week since the release and there's already some changes happening.



To celebrate our 1000th user on SensioLabs Connect in a week, we have just rolled out a new version that takes into account some of the feedback we had from the community after the launch.


Changes include updates to use Gravatar images if you choose not to upload a photo, fixes for a bug with email confirmations and a few new badges added to the system - "first 100 users", "attendees of SymfonyLive" and ones based on seniority in the community. A public API is in the works, but you can grab a profile in json by adding ".json" to the end of a profile URL (like Fabien's).

2011年11月16日星期三

Community News: Latest Releases from PHPClasses.org

Kevin Schroeder's Blog: Connecting to PHPCloud.com through Zend Studio 9


If you're a Zend Studio user and have been wondering how to hook it directly into the phpcloud service from Zend, Kevin Schroeder has posted complete instructions in a new post today (complete with screenshots).



PHPCloud.com is the landing page for our new cloud offering. Using the Zend Application Fabric you can build your applications in the same environment as you will be deploying your apps to. The application is built on my.phpcloud.com and you can then deploy it onto any platform where the Fabric is supported. But how do you get started? Phpcloud.com has been built in a way where you can connect with any IDE. With Zend Studio 9 that connectivity has been built directly in to the IDE.


It's a simple six (well, technically seven) step process that involves setting up a new project, configuring some deployment options and hitting "deploy". Zend Studio makes it super simple to launch your application as many times as you need - a one-click deploy once things are all set up.

Lorna Mitchell's Blog: Handling SQL Errors in PDO


Lorna Mitchell has a quick new post showing one way to handle SQL errors in PDO that could pop up because of badly written/generated SQL statements.



I love PHP's PDO (PHP Data Objects) extension; it gives a consistent, object-oriented interface to handling all kinds of relational database backends. One thing that annoys me is that the MySQL driver for PDO defaults to a silent error mode which can make SQL errors tricky to spot!


In her two code snippets she shows a failing PDO request (that fails silently) and a method for catching this issue - checking the result of the "errorCode" method to see if it equals "0" (zero). If there were errors, you can use the "errorInfo" function to get to them. This will return the SQL error code, the driver-specific error code and a driver-specific error message.

2011年11月15日星期二

Community News: Latest PECL Releases for 11.15.2011

Latest PECL Releases:

PHPMaster.com: Getting Started with PHPUnit


On PHPMaster.com today, there's a new tutorial helping you get started with on of the most popular unit testing frameworks for PHP, PHPUnit. In this new article they help you write your first tests, run them and figure out what to do when they fail.



Most people know that testing your websites is a good idea, but after some time testing can become tedious. What if a lot of this testing process could be automated so you don't have to go trough every function manually, time after time, to ensure that it still works after updating your code? This is where unit testing comes in, to automate the testing process.


She starts with a simple, self-contained test - setting and getting a "name" value from a User class. The tests include an example of a setup/tear down and check that the result of the "talk()" method is correct with an assertEquals.

2011年11月14日星期一

PHPMaster.com: Localizing PHP Applications "The Right Way", Part 3


PHPMaster.com has posted its third part of its "Localizing PHP Applications 'The Right Way'" series. In this third part you'll learn more about locales and message domain switching.



In Part 2 you gained more insight into using the gettext library by learning the most important functions of the extension. In this part you'll learn how to best use a fallback locale, switch between locales, and override the currently selected message domain.


They show you how to set up the directory structure to handle a fallback locale, a choice to use when the system can't determine which to use. By using a default, you also avoid having the system translate from the default language to...the default language (like "English" to "English"). Included are also the code bits you'll need to switch between locales (just using a different domain) and using the dgettext function to specify a different domain than the selected one.

2011年11月11日星期五

Site News: Popular Posts for the Week of 11.11.2011

Popular posts from PHPDeveloper.org for the past week:

Community News: Zend Framework 2 Development - CLA Not Required!


As is mentioned by Matthew Weier O'Phinney (and expanded on by Robert Basic) beginning immediately, the Zend Framework 2 project will no longer require developers to sign a CLA before submitting their code.



In #zf2 news, effective immediately, we no longer require a CLA for #zf2 contributions. Let the pull requests flow!


Robert gives a bit more detail in his post, pointing out the official git repo, the issues list, section on the wiki and the mailing list/IRC meetings. There's also a blog to follow to get the latest updates for the project.



If you'd like to find out more about this new version of the framework, check out this video from ZendCon by Matthew.

PHPMaster.com: PHP Master: Writing Cutting-Edge Code


On PHPMaster.com today (disclaimer: PHPMaster is a SitePoint website) Timothy Boronczyk has posted a review of SitePoint's latest offering for PHP developers - Writing Cutting-Edge Code (by Lorna Mitchell, Davey Shafik and Matthew Turland).



The book was written explicitly to help you becoming a better PHP programmer and is totally awesome. It not only covers advanced PHP coding topics such as object-oriented programming and design patterns, but also periphery topics that are just as important, such as security, performance profiling, and deployment. If you're ready to hang up your novice hat for good and become a professional-level PHP developer, this book is for you.


He goes through and highlights some of the content in the book, chapters covering relational databases, web services, security topics, caching, automated testing, PEAR/PECL....just to name a few.



Using the Slashdot scale of book ratings, where 1 is fit for lining cages and 10 is destined to be a class, I give PHP Master: Write Cutting-Edge Code a very solid 8.5. The content will grow with you and the book is not something you'll read in a weekend and then donate to the library because you have no need for it.

2011年11月10日星期四

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

PHPMaster.com: Error Handling in PHP


On PHPMaster.com today there's a new tutorial from Sneha Heda looking at error handling in PHP - the types of errors that can come up, how to throw your own and how to catch them appropriately.



Errors are the most common event a developer faces when programming. [...] To help reduce the number of errors in your code, and to mitigate their effects, proper error handling is essential in your web application. This article is a crash course in PHP error handling. You'll learn about PHP's built-in error reporting levels, and how to handle errors with custom error handlers and exception handling.


She starts with the different error reporting levels PHP offers, everything from the lightweight E_NOTICE out to E_ALL|E_STRICT. With this as a reference, she shows how to create a custom error handler (using set_error_handler). Also included is a look at exceptions and some of the more detailed information that comes with them - line numbers, messages, file the error was thrown from, etc.

Kowser's Blog: Kohana Tutorial: For the beginners


On his blog today Kowser introduces you to Kohana, an easy to use, lightweight PHP HMVC framework that can help you get applications up and running quickly. In his tutorial he walks you through the creation of a simple application - a typical blog.



Kohana is the framework I liked best among other PHP framework. Its an easy one also . To me it is organized, highly object oriented, having clear separation of model, view & controller. Autoloading of classes is nice feature here also. Here is the tutorial I prepared. [...] Probably you have downloaded the zip file from here.


He walks you through the initial setup and configuration first then jumps right into the code with an "Article" controller, a view to match and a simple model to hook into a "kohana_blog" table (creation SQL provided). Using this setup, he shows how to get a list of the current articles and update current ones/add new ones via a basic form.

2011年11月9日星期三

Community News: Latest Releases from PHPClasses.org

Anthony Ferrara's Blog: Becoming A Better Developer


Anthony Ferrara has a new post today on his blog with some things he think you can do to become a better overall developer (and not just in PHP). He shares six things from his own experience to help answer this question.



One of the most frequent questions that I get asked is "How can I become a better developer?" I think that it's a very good question to ask that deserves a good response. But how can you respond to something like that? Becoming a better developer depends so heavily on past experience (where to grow), interests and rationale (why do you want to grow), that it's really hard to answer without a fair bit of discussion. This post reflects my experiences from both my own growth and the growth that I've seen in others.


The things on his list are pretty simple, but they're easy to forget in your day to day development life. Things like being motivated to better yourself, gaining confidence in your abilities, sharing your knowledge and/or becoming a mentor to developers with less experience than you. Interestingly enough, this last one can sometimes teach you a little something about you and your processes too.

Kevin Schroeder's Blog: What programming rules should you ALWAYS follow?


In a quick new post today Kevin Schroeder asks his readers for feedback on what programming rules you should always follow in your development practices.



Earlier today, more for my own interest, I asked the question on Twitter "What programming rules should you ALWAYS follow, regardless of the scenario you're working in?" In other words, are there programming rules that you ALWAYS should follow. It doesn't matter if it's a script to copy a bunch of files for a one time migration or if you're building the next Facebook (DON'T try to build the next Facebook. You will fail miserably. Build something else). In other words, what was the purist of programming rules.


Responses he received ranged from the simple to slightly more complex including:



  • Always comment your code
  • Test your code
  • Use source control
  • "Think. Think again. Then write code"
  • Use a good debugger to help track down problems
  • Make effective use of logging/output

2011年11月8日星期二

Community News: Latest PECL Releases for 11.08.2011

Latest PECL Releases:

php|architect: Geolocation: Easier Than It Looks


On the php|architect site Jeremy Kendall has a new article looking at geolocation in PHP and how, despite some comments in the past about its difficulty, some more recent tools make it relatively simple.



Have you ever wanted to add location-aware content to your web applications? Would you believe me if I told you it was dead easy, and you could be up and running in about 10 minutes? The first thing you want to do is use someone else's work. Geolocation is a solved problem; there's no need to roll your own. I went searching for free Geolocation APIs and found two I wanted to try: MaxMind's GeoLite API and Quova.


He briefly introduces each data source - GeoLite as a downloadable database and Quova as an API. Sample code is included for using the data from both of these services to find a location based on an IP address. He does include one caveat though - be careful about accuracy, they usually only promise things to be within 25 miles of the spot you're actually looking for.

PHPMaster.com: The Importance of Standards


In a new article today on PHPMaster.com Robert Mariotti takes a look at standards and how important they can be when developing applications (both in following them and defining them correctly). It's not specifically targeted at PHP developers, but it does give some good food for thought.



As a long-time programmer, often with a staff of other programmers to watch over, I learned early in my career how important enforcing programming standards is in contributing to the overall success of a project. Not only do standards affect an individual's production of code, but they ensure that anyone else who may contribute code later can do so with a reasonable expectation of consistency.


He defines the abstract concept of "coding standards" as rules or guidelines that should be followed based on the application. Sure, there's more global standards for things (PSR-0 anyone?) but your needs will always be different and more fine-grained than those can get. He recommends standardizing everything, possibly using one of the standards popular open source projects have already laid out as a base.

2011年11月7日星期一

Community News: Latest PEAR Releases for 11.07.2011

Latest PEAR Releases:

Davey Shafik's Blog: Faster Arrays


In this new post to his blog Davey Shafik looks at an alternative to the traditional arrays most scripts use - something a little faster and more specific: SplFixedArray, part of the Standard PHP Library included with every release.



The SplFixedArray class provides a super-fast, fixed size array implementation. There are some limitations however, first you must use numeric keys and secondly you cannot use anonymous assignment (i.e. $array[] = 'value';). You'll notice one requirement was missing, that it should have a fixed size. While having a fixed size is what will bring you the speed increase it's actually not a requirement that the size be fixed.


Because of these restrictions, the SplFixedArray is faster than its cousin - between 20 and 40 percent faster, depending on the size of the array. He includes a few snippets in the the post - one showing how he benchmarked the differences against simple arrays and another showing a more advanced example with another SPL type, a FilterIterator.

Derick Rethans' Blog: Multiple PHP versions set-up


Derick Rethans has a new post today looking at a method for setting up multiple PHP versions on the same machine and switch between them with a little help from some simple bash scripts.



For many of my projects (both hobby and commercial) I need to support many different PHP configurations. Not only just different PHP versions, but also debug builds, ZTS builds and 32-bit builds. In order to be able to test and build extensions against all those different PHP configurations I have adopted a simple method that I'm sharing with you here.


Using this script he can tell his system to pull the latest version of any release from SVN and try to compile it. The trick is putting each of them into a different directory under /usr/local. He uses another small shell function (with a function called "pe()") that sets up the pathing to the right release, complete with its own locations for PEAR/PECL and a php.ini.

2011年11月4日星期五

Site News: Popular Posts for the Week of 11.04.2011

Popular posts from PHPDeveloper.org for the past week:

Anthony Ferrara's Blog: On PSR-0 Being Included In PHP's Core


In a new post to his blog today Anthony Ferrara looks at the (heated) discussion that's popped up around having the PSR-0 autoloader standard included as a part of the PHP core. He gives his reasons (three of them) why he's not for the decision.



Recently there has been a rather heated and intense discussion on whether the PSR-0 autoloader "standard" should be included as part of the PHP core (in ext/spl to be exact). I've tried to stay out of the discussion and have successfully done so. Until today. I feel that there's something that's been missing to the discussion. So rather then posting this to the internals list, I feel it's better served by a blog post on the subject. So here's my take on it.


As mentioned, he's not in favor of the inclusion for three different reasons:



  • It's inconsistent with current PHP functionality and would bias development one way or another
  • It's not an actual standard, just a loosely defined practice based on functionality already in place
  • There's noting for core to gain by adopting it and could cause problems trying to make things fit a one-size-fits-all solution.

Volker Dusch's Blog: An introduction to PHPUnits @covers annotation


PHPUnit is one of the most widely used unit testing tools for PHP applications. It comes packed with features, some that are commonly used and some not so much. In a new post to his blog today Volker Dusch looks at one specific feature - the "@covers" annotation you can use in your tests' comments to specify which functionality you're actually testing.



One of the goals of your test suite and the coverage report is to make you trust in your code base and to remove the fear of changing something that needs to be changed. [...] You shouldn't think "Well yes that a 100% but a lot of that just comes from that big integration test and I don't know if the class is really tested!". [...] Thankfully PHPUnit offers a way to drastically increase your confidence in what you actually have tested.


Using the "@covers" annotation on your test method docblocks gives you one more level of confidence in what's being tested and can help make for clearer updating down the road. He also mentions using them to provide extra insight into protected methods in your code and where the test coverage for them really lies.

DZone.com: Using a virtual machine to play with multiple versions of PHP


On DZone.com Giorgio Sironi has a new post talking about a development practice that's becoming more and more popular (rather than the old standby of one development platform for all developers) - using virtual machines as reusable, easily renewable platforms. He talks about the process he went through to set up PHP, including the commands used during the process.



This is an occasion to learn about a virtualization tool which I'm not familiar with, VirtualBox. The goal is to install PHP 5.4, which is not yet a stable release, to play around with new features such as traits without ruining the setup on my primary machine (which runs the super-stable PHP 5.3). Although it may be possible to run them together (I'm not a sysadmin), it's really simpler to install one of them in a virtual machine that can be thrown away if something goes wrong.


Using VirtualBox he describes the process of getting a Ubuntu system up and running including a custom compile of PHP with things like curl, bz2, mbstring and openssl support. With that installed and the Apache packages all set up, it should just be a matter of hitting your localhost's web server. If you're looking for older (or just other) versions of PHP to compile, check out the Historical Releases page on the PHP.net site.

2011年11月3日星期四

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

NetTuts.com: Zend Framework from Scratch


On NetTuts.com today there's a new tutorial helping you get started with Zend Framework "from scratch". They outline the full process - from download to the creation of a first application.



Ready to take your PHP skills to the next level? In this new "From Scratch" series, we'll focus exclusively on Zend Framework, a full-stack PHP framework created by Zend Technologies. First in our tutorial series, is "Getting Started with Zend Framework."


The tutorial (executed in a Windows environment) is broken up into seven parts:



  • Download Zend Framework
  • Set up your Zend Framework Environment
  • Create your First Zend Framework Project
  • Learn about Zend Framework's MVC Structure
  • Pass Data From a Controller to its View
  • Create a Layout in Zend Framework
  • Create New Controllers and Actions


They use the Windows version of Apache to host the site (installation instructions not included). If you'd like to get the source for this tutorial series as it evolves, you can find it on github.

Henrik Bj&oslashrnskov's Blog: Symfony2: How to do a Wizard (multistep form) with Doctrine2


Henrik Bj&oslashrnskov has a new post with a technique you can use to combine Symfony2 and Doctrine2 to create a multi-step form (a wizard) without having to worry about lost user information between steps.



The easy ways is doing it with Javascript and just show/hide the correct fieldsets when needed. The downside with this approach is that the data is only saved and validated once at the end. So if the user reloads the page the entered information is gone. The other way is to have every Step in the Wizard being a seperate form and validate the data based on what step you are on and save the necessary fields.


For his method, he created a Manager class with a StepInterface that returns the correct field names, forms and template information to render. The interface code is included in the post as well as an example of it in use setting up the wizard object, making a report and getting the correct step information from the wizard.

User Group: Seattle User Group Meeting Tonight (3rd) - PHP on Azure & Git


The Seattle PHP User Group is having this month's meeting tonight (the 3rd) starting at 6:30pm at Market Leader, Inc featuring talka from Brian Swan on "PHP on Azure" and Jesse Keating on "Git".



Market Leader,Inc. is graciously hosting the venue for Seattle PHP Meetup in Kirkland, WA this month!! In fact, Ariz Jacinto (long-time member & frequent presenter at our Meetups), an employee of Market Leader, Inc., has gone bonkers and lined up a killer night for us all! Note the entrance and then celebrate the FREE PARKING!!


Brian Swan is a Microsoft advocate for PHP on Windows and Jesse Keating is the release engineer for Fedora Core. There's still time to RSVP on Meetup and attend this event - be sure to sign up so they know how many to expect!

2011年11月1日星期二

Community News: Latest PECL Releases for 11.01.2011

Latest PECL Releases:

Developer Drive: Create Your Own CRUD App with MySQL and PHP


On the Developer Drive blog today there's a new tutorial helping you build out a simple CRUD (create, read, update and delete) system using a MySQL backend. This is just the first part of the series, introducing you to some concepts and getting the ball rolling connecting PHP and the database.



You're may be wondering what exactly CRUD is. CRUD simply stands for Create, Read, Update and Delete and it is the one of the fundamental principles of programming logic that can be expanded and applied to larger projects. For example, let's imagine we're creating a social network and we like to have the ability for users to create accounts, edit and update information for those accounts and also delete said accounts; that is CRUD at work.


This first part covers the structure of the database that'll make up the storage and includes a brief snippet of code to connect your PHP to the database (using PDO).

PHPMaster.com: Using the Ternary Operator


On PHPMaster.com today there's a new tutorial showing the use of a sometimes overlooked (but very handy) alternate syntax that PHP includes - the ternary operator, a short-hand if/else.



You're probably already familiar with PHP's if statement. It's very similar to its counterparts in many other programming languages and represents one of the most fundamental concepts in programming. [...] But there's a way to build on this concept and increase your $coolFactor a bit in the process. Allow me to introduce you to the ternary operator, which serves as a shorthand notation for if statements.


They introduce the ternary operator's syntax, the ":" and "?" operators and includes a few pieces of code showing its use. Thankfully they also include a warning - don't overuse or abuse it...and especially don't nest them - that just leads to headaches.

ArsMagnaTutorials: FuelPHP Tutorial Videos


On the ArsMagnaTutorials YouTube channel has posted three video tutorials (so far) covering the Fuel PHP framework, introducing you to some of the core concepts behind using this powerful framework.


The three videos in the series give an overview of:




You can find out more about Fuel on its website and more about the HTML5 Boilerplate here.