Feed aggregator
PHP Town Hall Podcast: Episode #7 - Web Sockets Are Fast
The PHP Town Hall podcast has posted a new episode - Episode #7: "Web Sockets Are Fast".
Chris Boden joins us to talk about a Ratchet and React. The conversation is basically Ben and Phil asking a bunch of questions about how Ratchet works, pretending we know what is going on while Chris uses lots of words like "concurrency" and "non-blocking". We decide that PHP is web-scale, event-driven programming is not just for NodeJS hipsters, we all take the "Are You a Brogrammer" test and Michael Wales crashes the show half way through like a ninja.You can listen to this latest episode either through the in-page player or by downloading the episode directly. You can also subscribe to their feed if you'd like the latest shows as they're released.
Link: http://phptownhall.com//blog/2013/06/18/episode-7-web-sockets-are-fastDear Ed (A response to Open Sourcing Mental Illness at php[tek] 2013)
Note: this post is personal, and may contain triggers for those suffering through grief. Due to it’s nature, I did pass it by Ed before posting it publicly, as every body is different when dealing with their mental illnesses, and this is such a complex topic that it’s difficult to talk about without drawing broad brush strokes that may offend some people. Please keep in mind that this is [some of] my thoughts on this very complicated subject, and you are free to disagree.
Dear Ed,
I felt that I needed to write this letter to you, and I wanted it to be open because I think it’s an appropriate way to participate in open sourcing mental illness. Consider this a pull request of sorts. The only way to remove the stigma around this topic is by talking frankly and openly about it.
I’m writing this (specifically) in response to the talk you gave at php[tek] last week. I remember first meeting you, at php|tek (as it was then known) in Chicago, sometime around 2003-4, one of my first conferences. You had some local friends meeting you there and we all hung out at the hotel bar. It was fun. But I remember the intimidation of meeting this hard core rock looking dude that I didn’t think I could possibly fit in with and relate to.
I was expecting to find a rough biker type dude, that would beat me up if I said the wrong thing… And I remember you were very intense (which I now know was passion) and I remember the change that came over your entire demeanor when you started talking about your son… The warmth and joy that I saw made me think “holy crap, this guy is just an awesome dad. I like this guy!”. Someone else has described this phenomenon as you turning into a pile of goo. As a fairly new father myself I now understand that so much better — thanks for being one of my first peer role models for being a father.
I don’t suffer from the kinds of mental illness you (we?) are trying to help, I have some very irrational (but “normal”) fears – needles and bugs, especially wasps and spiders – and travel stresses me out (TripIt Pro is so fantastic for helping me with that, ask me if you want details
.
I do however have experience with depression, and related things. I lost my father at age 11, and I lost my (first) wife at 22. These were traumatic, depressive, insane things to go through.
But I did get through them, and I feel stronger and happier at this end of that path. Thanks to folks like Ligaya Turmelle, Joey Smith, Matthew Turland and all three Elizabeths (Smith, Naramore and Tucker-Long), who have all at one time or another been a shoulder for me, I am now in a place where I can be laid back about most issues that many people simply can’t (the things that stress you out and cause anxiety on a daily basis). I live by “It is what it is”. But most folks can’t do that.
It is very difficult for me to relate to what people suffering from mental illness have been through in a lot of ways. The kinds of things I suffered from are considered “normal”, a part of the grieving process, and a temporary state; I personally don’t see it as the same thing as clinical depression — though they can lead to it — but “in the moment” they possibly are very similar.
I do however live with mental illness every day. My wife is bipolar (diagnosed and treated for about 6 years) and suffers from depression and anxieties. I see how it affects her, even with medication, and I really appreciate some more insight into a lot of things that she (like most people) has trouble verbalizing, so that I can help her handle it.
I don’t think I can help people suffering directly, I have no direct experience to draw from, other than my experiences with grief over a lost loved one… but I’m very open to any question about what I went through, and how I dealt with it from anyone (consider that an open invitation to anyone reading this.) But I wanted to let you know you have my support, admiration, and maybe even a little bit of love (OK a lot: internet hugs!) for opening yourself up to help this community we both hold so near and dear.
So, thank you!
- Davey
7PHP.com: Know Thy PHP User Group Know The Leeds PHP User Group (LeedsPHP)
On 7PHP.com today Khayrattee Wasseem has posted another community interview, this time with Craig Willis the organizer of the Leeds PHP user group in the UK (West Yorkshire).
This is the #1st set of 'Know Thy PHP Usergroup' in an attempt to create more awareness of: what is $this PHP UG about + get to know the leaders/Founders/Community behind it, what is a PHP User Group in general and to personally know all the PHP user goups Around The World - that excites me and I hope you too! This concept is also a good opportunity for new #elePHPants to know about PHP UGs.They talk some about the group itself as well as some of Craig's thoughts about about leading the group. They talk some about the goals of the group, the usual activities of it and how the meetups are planned. There's also a bit about finding sponsors for the group and how it compares to other groups of the same type.
Link: http://7php.com/php-usergroup-leedsphpAndrew Podner: Functional Testing to Improve Quality Assurance (part 1)
Andrew Podner has posted the first part of a new series to his site today. He'll be looking at using functional testing to improve quality of the resulting code and full application.
For this week, I wanted to focus on some different types of automated testing other than unit testing that can help developers build more robust applications and improve both the speed and effectiveness of quality assurance. Specifically, this post is going to focus on functional testing. Functional testing is composed of the tests that you write which are from the user's point of view. A functional test is used to perform quality assurance on all or part of an application utilizing the user interface as a pathway to the application.He gives some examples of functional tests like clicking on buttons, trying a login, checking that the contents of the page are correct. He talks some about the purpose of functional testing and how it differs from unit testing. He suggests the metaphor of a race car - the pit crew would be the "unit testers" and the driver would be the "functional tester", saying whether or not all of the parts of the car are working together as they should for the race. In the next part of the series, he'll talk some about the actual software to automate this process.
Link: http://unassumingphp.com/functional-testing-to-improve-quality-assurance-part-1Community News: Packagist Latest Releases for 05.20.2013
- rocker/server (1.1.6)
Boilerplate that helps you write RESTful web services on top of Slim framework (https://github.com/victorjonsson/PHP-Rocker#php-rocker)
- cypresslab/gitelephant (1.0.0-alpha2, 1.0.0-alpha)
An abstraction layer for git written in PHP 5.3
- clubmaster/quickpay (1.1)
Quickpay payment gateway.
- clubmaster/formextra (1.3)
ClubMaster form extra.
- ze-pequeno/pequeno-spotify-module (1.0.1)
Zend Framework 2 Module for Spotify Web API
- slm/locale (v0.0.1)
Automatic detection of locales for Zend Framework 2
- jeboehm/lampcp (0.5.0)
The linux apache mysql php control panel
- ehough/stash (2.0.1)
Fork of tedivm/stash compatible with PHP 5.2+
- ehough/filesystem (1.0.1)
Fork of Symfony's Filesystem Component compatible with PHP 5.2+
- bitgandtter/google-bundle (0.2)
Integrate the Google Platform into your Symfony2 application.
- egulias/email-validator (1.0.0, 1.0.1)
A library for validating emails
- molajo/fieldhandler (v1.0)
Molajo FieldHandler: Validates and Filters Input; Escapes and Formats Output
- slam/tcpdf (6.0.018)
TCPDF is a PHP class for generating PDF documents.
- tecnick.com/tcpdf (6.0.018)
TCPDF is a PHP class for generating PDF documents.
- bmatzner/fontawesome-bundle (3.1.1)
FontAwesome Bundle for Symfony2
- jpiasetz/oanda (0.5.3, 0.5.1, 0.5.2)
Oanda PHP wrapper for PHP 5.4+
- bmatzner/jquery-ui-bundle (1.10.3)
jQuery UI Bundle for Symfony2
- bmatzner/require-bundle (2.1.6)
RequireJS Bundle for Symfony2
- bmatzner/marionette-bundle (1.0.2)
MarionetteJS Bundle for Symfony2
- alexshelkov/simpleacl (2.0.17)
Simple Access Control List (ACL) for PHP.
- bmatzner/lodash-bundle (1.2.1)
Lo-Dash Bundle for Symfony2
- bmatzner/foundation-bundle (4.1.6)
ZURB Foundation Bundle for Symfony2
- bmatzner/mediaelement-bundle (2.11.3)
MediaElement.js Bundle for Symfony2
- tfox/calendar-bundle (1.0.0)
This bundle allows to render calendars using Twig engine. Additional parameters might be added for each day, month and week.
- f21/paradox (1.3.0)
Paradox is an elegant Object Document Mananger (ODM) to use with the ArangoDB Document/Graph database server.
- n98/magerun (1.68.0)
Tools for managing Magento projects and installations
- phpspec/phpspec (2.0.0-BETA4)
Specification-oriented BDD framework for PHP 5.3+
- phpspec/prophecy (v1.0.2)
Highly opinionated mocking framework for PHP 5.3+
- sindriphp/database (0.6.0)
Database Component (Bifröst)
- mv/mv-blog-bundle (v1.2.2-beta)
Symfony2 Blog Bundle
- uam/datatables-bundle (1.0.0)
Datatables jquery plugin packaged as a Symfony bundle
- moriony/silex-mongo-provider (1.1)
Mongo service provider for the Silex framwork.
- uam/aws-bundle (0.1.3, 0.1.2)
Symfony bundle to provide a wrapper service around AWS S3
- uam/propel-s3object-behavior (0.1.8, 0.1.7)
A Propel behavior that allows objects to save a file to AWS S3.
- rocker/facebook-login (1.0.5)
Package that makes it possible to authenticate against a PHP-Rocker application using facebook (https://github.com/victorjonsson/PHP-Rocker)
- zweifisch/f (v0.0.1)
building blocks for functional php
Survived php tek 2013
If you were last week in Chicago, you've might felt the city was buzzing PHP all over the place. php[tek] 2013 was taking place at the Sheraton Gateway Suites Chicago O'Hare in Rosemont, just outside of Chicago city.This year it was also the first time Musketeers.me, a php consulting team from the East Coast, was running the show, putting their own signature onto the event. And with great success I might add. A well deserved applause to Eli White, Kevin Bruce, Sandy Smith, Oscar Merida and of course the Beth Tucker Long for their unlocked achievement running a great conference.
For me was also the first time I was running the uncon, where attendees and conference speakers could propose talks they wanted to present at the uncon and have other attendees vote for them.
One uncon talk really stood out: "Open Sourcing mental illness" by Ed Finkler (@funkatron) where he discussed the issues people face who suffer a mental illness. It was an emotional talk where Ed described his own experiences and how his mind made him think about things differently then the rest of us. For me it was a real eye-opener and made me understand that there are people that don't really take things for granted.
This year's edition was filed with very good talks and it's almost impossible to give my feedback on all of them. A few talks that I attended really stood out that I would really want to promote here.
Chris Cornut, the driving force behind phpdeveloper.org, talked about "Beyond the Basics: Security with PHP" where he did not just list the top 10 of OWASP, but also gave good advices on how to protect yourself against most of the common attacks. A good closing hint: be better secured than the next guy.
Jeremy Kendall was giving good advice on how to improve your code you wrote a couple of weeks or months ago in his talk "PHP 102: Out with the Bad, In with the Good". What I like about Jeremy is he can bring very complex subjects in an easy, understandable way that even a novice can understand complex software engineering stuff. And so he did with this talk.
One talk I missed which I really wanted to see was the Distractions talk of Sean Prunka, or how to deal with distractions when you're a developer. When I look at the reviews on joind.in I see he did an amazing good job giving this was his first conference talk ever. So hopefully he will do a webinar or an online recording of this talk *hint, hint*.
This year my company was sponsoring the hackathon and can be called a good success, knowing we had to compete against Lego fun party. According to Lorna a bunch of pull requests were made for joind.in (the community feedback platform for conference speakers). And we captured the first pull request on twitter.
Can I get a woot? First @joindin pull request of the night has been merged at #tek13 hackathon!
— Lorna Mitchell (@lornajane) May 16, 2013<script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"/>
At the introduction of the hackathon we also had a nice surprise for Mr. Keith Casey from his colleagues at Twillio where he worked 2 years now.
"/>
Truncated by Planet PHP, read more at the original (another 2560 bytes)
Community News: Latest PEAR Releases for 05.20.2013
5 Reasons Why the Web Platform War is Over: PHP Won with 75% says Google
Read this article to understand why this puts an end to years of false claims that PHP was losing market, as well what it means to Web developers using PHP or other languages.
Community News: Packagist Latest Releases for 05.19.2013
- dudapiotr/zftable (0.0.3)
Flexible tool to generate table
- kamisama/cake-resque (3.3.6)
A CakePHP plugin for creating background jobs with Resque
- inori/banklink (v0.2.4, v0.2.3, v0.2.2, v0.2.1)
Banklink is a PHP library that makes integrating various Baltic banks internet services ('bank links') easy, fast and reliable.
- rocker/google-login (1.0.2, 1.0.0)
Package that makes it possible to authenticate against a PHP-Rocker application using google user credentials (https://github.com/victorjonsson/PHP-Rocker)
- cloudspeedy/fastly-php (1.0.1)
Fastly PHP client library
- titon/io (0.4.2)
The Titon IO package provides classes that handle file manipulation and resource bundling.
- rocker/server (1.1.5)
Boilerplate that helps you write RESTful web services on top of Slim framework (https://github.com/victorjonsson/PHP-Rocker#php-rocker)
- rocker/facebook-login (1.0.4)
Package that makes it possible to authenticate against a PHP-Rocker application using facebook (https://github.com/victorjonsson/PHP-Rocker)
- phpbenchmark/phpbenchmark (1.0.1)
Easy to use benchmark toolkit for your PHP-application. This library contains classes for comparing algorithms as well as benchmarking application responses
- snakano/propel-data-cache-behavior (1.0.0)
propel data cache behavior
- snakano/cache-store (1.0.0)
provides a generic way to cache any data
Community News: Packagist Latest Releases for 05.18.2013
- kamisama/resque-status (0.0.1)
A API for saving a php-resque worker settings and status
- bear/ace (0.2.0)
Ace online editor utility
- bcen/silex-dispatcher (0.4.1)
A Silex plugin
- klein/klein (v2.0.1, v2.0.0)
A lightning fast router for PHP
- liip/rmt (0.9.6)
Release Managment Tool
- danielmewes/php-rql (1.5.1)
A PHP client driver for the RethinkDB query language (ReQL)
- n98/magerun (1.67.0, 1.66.0)
Tools for managing Magento projects and installations
- smirik/bootstrap-bundle (v2.3.2)
Simple bundle which add bootstrap css and js files to project and standard template to the form.
- adamstipak/nette-rest-route (1.1.0)
Rest route for Nette Framework
- nunzion/composer-devlinks (0.1.0)
Enables developers to autoload classes from projects outside the vendor directory. These links can replace projects inside the vendor directory and need not to be committed.
- entomb/slim-json-api (0.1)
Slim extension to implement fast JSON API's
- pscheit/psc-cms (1.1.3)
a content management system ontop of webforge.
- pihi/industrial (0.4.4)
Dependency Injection for PHP 5.3
- wrep/daemonizable-command (1.0.0)
Daemonizable (endless running) commands for Symfony2.
- yvann/urlify (1.0.0)
PHP port of URLify.js from the Django project. Transliterates non-ascii characters for use in URLs.
- rampage-php/framework (1.0.0-alpha8)
Rampage PHP Framework based on Zend Framework 2
- nunzion/php-common (0.1.0)
Commonly used php functions.
- fritz-payment/jsonrpc (0.1.0)
A general JSON RPC client.
- liip/imagine-bundle (v0.10.0)
This Bundle assists in imagine manipulation using the imagine library
- propel/propel-bundle (1.2.3)
Integration of Propel in Symfony2
- bit3/contao-nested-menu (1.0.3)
Nested menus for Contao OpenSource CMS
- jasonlewis/basset (v4.0.0-BETA1)
A better asset management package for Laravel.
DZone.com: Cloning in PHP
In this recent post over on DZone.com Giorgio Sironi takes a look at the "clone" feature of PHP - what it is, how it can be used and things to watch out for in its use.
Cloning is an operation consisting in the duplication of a data structure, usually to avoid the aliasing problem of having different code modify the same instance in inconsistent ways. In PHP, cloning can be accomplished in multiple ways - and in some cases it can be avoided altogether.He talks some about how objects are passed around internally during the PHP execution and how you can tell if a function works with data by reference (from the manual). He then looks at the "clone" keyword and what kinds of things are duplicated from an object when it is used. He briefly touches on the "__clone" magic method for solving the "shallow clone" problem and how, possibly, serializing the object might be a better alternative for reproducing the entire object.
Link: http://css.dzone.com/articles/cloning-phpPHPMaster.com: Openbiz Cubi: A Robust PHP Application Framework, Part 1
On PHPMaster.com today they've posted the first part of a series spotlighting Openbiz Cubi, a PHP "framework" with a business focus.
Openbiz Cubi is a robust PHP application framework giving developers the ability to create business applications with minimal effort. In this two-part series I'll explain the concepts and steps necessary to create your own business web applications with Cubi. We'll look first at the challenges web developers face and how Openbiz Cubi can help, and then how to install Cubi. In part 2 we'll see how to create our own modules.They start off by describing the tool and some of the features that come with it (including user management and the XML data object structure). Complete installation instructions are included and a screenshot is included of the end result. They include a "quick tour" of Cubi's features and some of the modules that come with it like the System, Menu and User modules. In part two of the series, they'll show you how to create a custom module.
Link: http://phpmaster.com/openbiz-cubi-a-robust-php-application-framework-1Chris Jones: Offline Processing in PHP with Advanced Queuing
Chris Jones has a new post today showing you how to use Oracle and PHP together to process data offline via the Oracle Streams Advanced Queuing feature.
Offloading slow batch tasks to an external process is a common method of improving website responsiveness. One great way to initiate such background tasks in PHP is to use Oracle Streams Advanced Queuing in a producer-consumer message passing fashion. [...] The following example simulates an application user registration system where the PHP application queues each new user's street address. An external system monitoring the queue can then fetch and process that address. In real life the external system might initiate a snail-mail welcome letter, or do further, slower automated validation on the address.He includes the SQL needed to create the database and configure the queue system as well as start it up and get it ready for requests. He shows how to push an address into the queue for processing and how to get the results once it has completed in both the SQL and from the oci_* functions in PHP.
Link: https://blogs.oracle.com/opal/entry/offline_processing_in_php_withCommunity News: Packagist Latest Releases for 05.17.2013
- piwik/piwik (1.12-b15)
Open Source Real Time Web Analytics Platform
- donatj/simplecalendar (v0.4.0)
A very simple calendar library
- icecave/chassis (0.3.0)
A template engine for filesystem structures.
- herrera-io/go (2.0.1, 2.0.0)
A simple PHP build tool.
- herrera-io/cli-app (1.0.2)
A simplified CLI application template built on Symfony Console.
- aporat/application_rest_controller_route (1.0.0)
RESTful Zend_Controller_Router_Route with custom defined routes
- sensio/framework-extra-bundle (v2.3.0-RC1)
This bundle provides a way to configure your controllers with annotations
- symfony/symfony (v2.3.0-RC1)
The Symfony PHP framework
- aporat/application_controller_plugin_forcessl (1.0.0)
Zend Framework 1 controller plugin that force all http requests to be under SSL
- doctrine/doctrine-module (0.7.2)
Zend Framework 2 Module that provides Doctrine basic functionality required for ORM and ODM modules
- phundament/p3pages (0.11.6)
Page Manager
- jiriknesl/mockista (1.2)
Mockista is library for mocking, which I've written, because I find mocking in PHPUnit slow.
- georgeh/php-beerxml (1.0.0)
BeerXML parser and generator
- tecnick.com/tcpdf (6.0.017)
TCPDF is a PHP class for generating PDF documents.
- havvg/lock (v1.0.0)
A component for simple resource locking.
- payum/payum-bundle (0.4.1)
The payment bundle integrates payum libs into symfony2 framework
- phundament/p3widgets (0.11.4)
Widget Manager
- zweifisch/zf (v0.2.6)
a micro php web/cli framework/router
- rah/danpu (2.4.0, 1.4.0)
MySQL database dump and restoration tool implemented in PHP
- rampage-php/framework (1.0.0-alpha7)
Rampage PHP Framework based on Zend Framework 2
- symfony/intl (v2.3.0-RC1)
A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
- webignition/css-validator-output-parser (1.6.3)
Parser for output from the W3C CSS validator
- symfony/icu (v1.2.0-RC1, v1.1.0-RC1, v1.0.0-RC1)
Contains an excerpt of the ICU data and classes to load it.
- dudapiotr/zftable (0.0.2)
Flexible tool to generate table
- willdurand/email-reply-parser (1.0.0)
Port of the cool GitHub's EmailReplyParser library in PHP 5.3
- jbboehr/facebook-php-cli (1.0.0)
Facebook PHP SDK Wrapper for CLI
- kriswallsmith/assetic (v1.1.0)
Asset Management for PHP
Site News: Popular Posts for the Week of 05.17.2013
- PHPMaster.com: MongoDB Indexing, Part 2
- PHP.net: PHP 5.4.15 and PHP 5.3.25 released!
- NetTuts.com: 10 Tips for Learning a New Technology
- 7PHP.com: A Chat With Adminer - A Simple, Yet Effective, Database Management tool written in PHP
- Site News: Popular Posts for the Week of 05.10.2013
- Chris Jones: Getting Started with PHP Zend Framework 2 for Oracle DB
- Community News: Packagist Latest Releases for 05.11.2013
- MaltBlue.com: Zend Framework 2 - Hydrators, Models and the TableGateway Pattern
- Simon Holywell: Improve PHP session cookie security
- Community News: Packagist Latest Releases for 05.10.2013
Offline Processing in PHP with Advanced Queuing
Offloading slow batch tasks to an external process is a common method of improving website responsiveness. One great way to initiate such background tasks in PHP is to use Oracle Streams Advanced Queuing in a producer-consumer message passing fashion. Oracle AQ is highly configurable. Messages can queued by multiple producers. Different consumers can filter messages. From PHP, the PL/SQL interface to AQ is used. There are also Java, C and HTTPS interfaces, allowing wide architectural freedom.
The following example simulates an application user registration system where the PHP application queues each new user's street address. An external system monitoring the queue can then fetch and process that address. In real life the external system might initiate a snail-mail welcome letter, or do further, slower automated validation on the address.
The following SQL*Plus script qcreate.sql creates a new Oracle user demoqueue with permission to create and use queues. A payload type for the address is created and a queue is set up for this payload.
-- qcreate.sql connect / as sysdba drop user demoqueue cascade; create user demoqueue identified by welcome; grant connect, resource to demoqueue; grant aq_administrator_role, aq_user_role to demoqueue; grant execute on dbms_aq to demoqueue; grant create type to demoqueue; connect demoqueue/welcome@localhost/orcl -- The data we want to queue create or replace type user_address_type as object ( name varchar2(10), address varchar2(50) ); / -- Create and start the queue begin dbms_aqadm.create_queue_table( queue_table => 'demoqueue.addr_queue_tab', queue_payload_type => 'demoqueue.user_address_type'); end; / begin dbms_aqadm.create_queue( queue_name => 'demoqueue.addr_queue', queue_table => 'demoqueue.addr_queue_tab'); end; / begin dbms_aqadm.start_queue( queue_name => 'demoqueue.addr_queue', enqueue => true); end; /
The script qhelper.sql creates two useful helper functions to enqueue and dequeue messages:
-- qhelper.sql
-- Helpful address enqueue/dequeue procedures
connect demoqueue/welcome@localhost/orcl
-- Put an address in the queue
create or replace procedure my_enq(name_p in varchar2, address_p in varchar2) as
user_address user_address_type;
enqueue_options dbms_aq.enqueue_options_t;
message_properties dbms_aq.message_properties_t;
enq_id raw(16);
begin
user_address := user_address_type(name_p, address_p);
dbms_aq.enqueue(queue_name => 'demoqueue.addr_queue',
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => user_address,
msgid => enq_id);
commit;
end;
/
show errors
-- Get an address from the queue
create or replace procedure my_deq(name_p out varchar2, address_p out varchar2) as
dequeue_options dbms_aq.dequeue_options_t;
message_properties dbms_aq.message_properties_t;
user_address user_address_type;
enq_id raw(16);
begin
dbms_aq.dequeue(queue_name => 'demoqueue.addr_queue',
dequeue_options => dequeue_options,
message_properties => message_properties,
payload => user_address,
msgid => enq_id);
name_p := user_address.name;
address_p := user_address.address;
commit;
end;
/
show errors
The script newuser.php is the part of the PHP application that handles site registration for a new user. It queues a message containing their address and continues executing:
<?php
// newuser.php
$c = oci_connect("demoqueue", "welcome", "localhost/orcl");
// The new user details
$username = 'Fred';
$address = '500 Oracle Parkway';
// Enqueue the address for later offline handling
$s = oci_parse($c, "begin my_enq(:username, :address); end;");
oci_bind_by_name($s, ":username", $username, 10);
oci_bind_by_name($s, ":address", $address, 50);
$r = oci_execute($s);
// Continue executing
echo "Welcome $username\n";
?>
It executes an anonymous PL/SQL block to create and enqueue the address message. The immediate script output is simply the echoed welcome message:
Welcome Fred
Once this PHP script is executed, any application can dequeue the new message at its leisure. For example, the following SQL*Plus commands call the helper my_deq() dequeue function and displays the user details:
-- getuser.sql
connect demoqueue/welcome@localhost/orcl
set serveroutput on
declare
name varchar2(10);
address varchar2(50);
begin
my_deq(name, address);
dbms_output.put_line('Name : ' || name);
dbms_output.put_line('Address : ' || address);
end;
/
The
Truncated by Planet PHP, read more at the original (another 1511 bytes)
NetTuts.com: How to Write Testable and Maintainable Code in PHP
NetTuts.com has a new tutorial posted suggesting a few ways you can make testable and maintainable code in PHP applications.
Frameworks provide a tool for rapid application development, but often accrue technical debt as rapidly as they allow you to create functionality. Technical debt is created when maintainability isn't a purposeful focus of the developer. Future changes and debugging become costly, due to a lack of unit testing and structure. Here's how to begin structuring your code to achieve testability and maintainability - and save you time.There's a few concepts they cover in the tutorial including DRY (don't repeat yourself), working with dependency injection and actually writing the tests with PHPUnit. They start with a bit of code that needs some work and use the tests to help refactor it into something that can be easily mocked (using Mockery).
Link: http://net.tutsplus.com/tutorials/php/how-to-write-testable-and-maintainable-code-in-phpBob Majdak: On SQL in PHP
In a new post to his site Bob Majdak looks at using SQL in PHP and some of the challenges he's come across (some of them with his own tools). He talks about things line inline SQL, loading SQL by unique key or creating a "build object".
There is no right or wrong way, but no matter what there is no *pretty* way to do SQL inside of a PHP application. I have been having a personal debate with myself all week about how to make SQL statements nicer in an application without going to a huge DBAL package like Doctrine.He looks at each idea and provides some of the pros and cons about each of them, noting that he hasn't quite decided on which is the best method. Some sample code is included to help clarify the points, showing the "find by unique key" version and how a more complex query might be created with the "builder object."
Link: http://catch404.net/2013/05/on-sql-in-phpCommunity News: Google App Engine now Supports PHP runtime
On the Google Developers Blog (and lots of places across the web) there's a major update that Google has done for their AppEngine service - the introduction of a PHP runtime to their offerings.
App Engine 1.8.0 is now available and includes a Limited Preview of the PHP runtime - your top requested feature. We're bringing one of the most popular web programming languages to App Engine so that you can run open source apps like Wordpress. It also offers deep integration with other parts of Cloud Platform including Google Cloud SQL and Cloud Storage.You can get more information about how to use this new feature on Google App Engine site.
Link: https://gaeforphp.appspot.comPádraic Brady: Publishing Security Disclosures In Consumable Formats
Pádraic Brady has a new post today proposing that what the PHP ecosystem needs is a way to better publish security disclosures in a format that's easy to parse and deal with.
This is a branch off from a separate discussion on the PHP-FIG mailing list about other ways the Framework Interoperability Group can encourage and foster wider interoperability among its member projects (and by extension, the whole PHP community). I'll start by noting two interesting developments in recent months and one long standing best practice.The two "interesting developments" he mentions are the relatively recently released SensioLabs Security Checker that uses you Composer file to find security issues and the new entry in the latest version of the OWASP Top 10 list for "Using Components with Known Vulnerabilities". The best practice he talks about is more around the timely/responsible disclosure of vulnerabilities and how some kind of decentralized tracking of these issues that puts the responsibility back on the developers of the tool and not on one tracking resource.
Link: http://blog.astrumfutura.com/2013/05/publishing-security-disclosures-in-consumable-formats-for-simpler-aggregation-and-security-checking