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

Phil Sturgeon:
Named Parameters in PHP
September 02, 2013 @ 10:52:40

in a new post to his site Phil Sturgeon talks about a new (old?) proposal to introduce named parameters into PHP.

Named Parameters for PHP is not a new conversation. It's reared its head several times - so much so that the named parameters RFC says: "Since the topic continually gets re-raised, and now PHP has an RFC process, the discussion should be recorded in an RFC (Note this is yet to be done) so the same arguments don't have to be revisited."

He notes the negative attitude that seems to currently be shown in the RFC and has made the offer to rewrite it to be more impartial to the subject at hand. In the comments of the post there's also some feedback about the different syntaxes and varying levels of support for the proposal.

0 comments voice your opinion now!
named parameter language feature rfc rewrite

Link: http://philsturgeon.co.uk/blog/2013/09/named-parameters-in-php

Jeremy Kendall:
API Query Authentication With Query Auth
August 15, 2013 @ 09:41:46

Jerermy Kendall has written up a post for his site showing the use of his QueryAuth library for API authentication, complete with plenty of examples. The library makes it simple to sign and verify requests based on a key, secret and parameters given.

Most APIs require some sort of query authentication: a method of signing API requests with an API key and signature. The signature is usually generated using a shared secret. When you're consuming an API, there are (hopefully) easy to follow steps to create signatures. When you're writing your own API, you have to whip up both server-side signature validation and a client-side signature creation strategy. Query Auth endeavors to handle both of those tasks; signature creation and signature validation.

He includes code examples showing how to create a signed request, validate the signature from an incoming request and generate randomized keys and secrets. He's also created a sample implementation as a Vagrant box that sets up a Slim framework based application and uses Guzzle to make requests. He briefly looks at some of the code that makes it work and what the raw HTTP request and response look like for the result.

0 comments voice your opinion now!
queryauth api authentication signature parameter key secret tutorial

Link: http://jeremykendall.net/2013/08/13/api-query-authentication-with-query-auth

Lukas Smith's Blog:
Query parameter handling in Symfony2
May 14, 2012 @ 11:56:37

Lukas Smith is looking for feedback about a question that's been in his mind a lot lately - can the handling of query parameters be made better for the Symfony2 framework (and even easier to use).

Obviously you can already access query parameters today already but it could be easier. Essentially what I want is a way for developers to easily configure what query parameters they expect and what values they expect. This is useful for several things like easier reading and validating of query parameters, self documenting API both for API docs for humans but also for machines.

He's asking for feedback and ideas from the community on a proposed solution that could make things more flexible. He also briefly mentions the route matching and how qurey parameters could cause them not to match:

For one I don't think that a mismatch on a route requirement of a query parameter cause the route to not match. However then it can quickly become confusing for the end user or it would require adding more and more syntax to handle all the different cases.
0 comments voice your opinion now!
symfony2 query parameter handling solution routing match


Kevin Schroeder's Blog:
Remote Debugging with the Zend Debugger and PHPUnit
May 01, 2012 @ 09:27:47

Kevin Schroeder has a quick new post with a one-liner you can use to get remote debugging working with Zend Debugger and PHPUnit.

I'm trying to do some remote debugging with PHPUnit on a remote system. I was following the rules I had written about in a previous article but for some reason I could not get path mapping to work. So I figured I'd ping the Studio lead developer because as soon as I did that I'd get it to work. Well, that's what happened.

His fix comes in the form of setting a command-line parameter, QUERY_STRING, with the correct parameter order so the paths will get mapped back to the correct project. This parameter is a URL-encoded set of parameters that do things like start the debugging, set up the hostname for the debugger to point to and map the "original URL" back to your choice of values.

0 comments voice your opinion now!
remote debug phpunit zenddebugger querystring parameter variable


Kevin Schroeder's Blog:
ZF2 Dependency Injection - Multiple Object Instances
April 30, 2012 @ 12:15:34

Kevin Schroeder has a quick new post about using dependency injection in Zend Framework 2 applications using multiple object instances.

When you work with the ZF2 Dependency Injection Container (DiC) when you make multiple requests for an instance of an object you will get the same object back each time. [...] But what if you want the injection benefits of the DiC but don't want to share the object? Use the DiC's newInstance method instead with the third parameter being false.

He includes code examples of requesting the object both ways - the usual way that returns the same object and the alternative that passes in a "false" value, complete with a debug output of each object proving they're different.

0 comments voice your opinion now!
zendframework2 dependency injection dic multiple object parameter false


Anthony Ferrara's Blog:
Parameter Type Casting in PHP
March 06, 2012 @ 11:05:32

Anthony Ferrara has a new article posted to his site today about parameter typecasting and the discussions that have been happening about it on the PHP "internals" mailing list.

As any of you who follow the PHP internals list know, scalar type hinting has been a hot topic as of late. You'll also know that I've submitted two new RFC (Request For Comment) proposals for inclusion of two new major features in the PHP language. I figured it was worth going into both RFCs and patches a little deeper, explain my rationale and (hopefully) garner some more visibility of the proposals.

He shares the details of the two main RFCs that are proposed right now - parameter type casting hints and object scalar casting magic methods (both with code examples). Right now, they're only in the patch stage and there's talk of improving the current casting functionality of PHP before something like one of these goes into place.

0 comments voice your opinion now!
parameter type casting proposals rfc internals mailing list


Ulf Wendel's Blog:
Using MySQL stored procedures with PHP mysqli
November 04, 2011 @ 11:39:18

Ulf Wendel has a new post today with details on using stored procedures with mysqli - not overly difficult if you know how to handle the IN, OUT and INOUT parameters. He includes a few code examples showing how to use them.

Out of curiosity I asked another friend, a team lead, how things where going with their PHP MySQL project, for which they had planned to have most of their business logic in stored procedures. I got an email in reply stating something along the lines: "Our developers found that mysqli does not support stored procedures correctly. We use PDO.". Well, the existing documentation from PHP 5.0 times is not stellar, I confess. But still, that's a bit too much... it ain't that difficult. And, it works.

He describes the three parameters (IN, OUT and INOUT) and gives some examples of setting/getting them from your SQL statements. They're all still set up using the query method on your connection as well as handling the result sets that come back and working with prepared statements.

0 comments voice your opinion now!
mysql stored procedures mysqli database in out inout parameter


Anthony Ferrara's Blog:
IteratorIterator - PHP Inconsistencies And WTFs
November 01, 2011 @ 12:58:07

Anthony Ferrara has a new post to his blog sharing some inconsistencies with iterators that he discovered as discussed with a fellow developer - why some iterators only accept Iterator arguments and others don't.

We were talking about why some of the SPL Iterators accept only an Iterator as the constructor argument (Such as LimitIterator), and others accept either an Iterator or an IteratorAggregate as the argument (Such as IteratorIterator). Feeling that this would be a useful feature to add (having all of them accept an IteratorAggregate), I opened up the PHP source and started looking at how hard of a change this would be. What I found was... Interesting...

He shares some of the C code he came across in his investigation including a "WTF" moment when he found a case statement for DIT_IteratorIterator in a constructor. Because of some of the logic in this constructor, the inputted iterator is "cast down" to a class. This is shown in a few code examples comparing simple iteration objects and arrays and how it seems to be able to bypass class inheritance to use methods from other classes.

0 comments voice your opinion now!
iterator iteratoriterator wtf constructor optional parameter class


rooJSolutions Blog:
Watch-out PHP 5.3.7+ is about.. and the is_a() / __autoload() mess.
September 02, 2011 @ 10:43:24

New from the rooJSolutions blog there's a post pointing out an issue that PHP 5.3.7 has broken the is_a functionality in a lot of cases. The post talks some about what's broken and how you can work around it if you're effected.

The key issue was that 5.3.7 accidentally broke is_a() for a reasonably large number of users. Unfortunately the fixup release 5.3.8 did not address this 'mistake', and after a rather fruitless exchange I gave up trying to persuade the group (most people on mailing list), that reverting the change was rather critical (at least pierre supported reverting it in the 5.3.* series).

This new issue was causing some strange errors to pop up in his code because of a parameter type change in the is_a call, updating the first parameter to be an object instead of a class name. The is_a() call sends its requests to __autoload in some cases and the string->object mismatch of those parameters causes errors to be thrown. His workaround is, in your checking, just be sure to call an is_object first before passing things off to be is_a() checked and autoloaded.

0 comments voice your opinion now!
bug isa autoload parameter change string object


Justin Carmony's Blog:
PHP Itch to Scratch Object Notation
April 14, 2011 @ 13:42:33

In a new post to his blog Justin Carmony talks about a few "itches" he's wanted to scratched when it comes to features of the PHP language - in this post it's the notation that's used surrounding the use of objects.

At the end [of Marco's post to his blog], he states it ultimately boils down to find a better way to bring features build downstream back upstream. So I thought I would do my part by first my blogging about a few "itches" I'd love to see scratched. My first itch would be some form of Object Notation for PHP.

He talks about the notation method that Javascript has always had and how it can help to make objects more flexible by not forcing their creation through a method/argument interface. He offers one potential solution - using arrays for settings values - but notes that it could be more trouble than it's worth in the implementation. He proposes a new sort of notation instead, one that allows the passing of something similar to the Javascript JSON-ish definition of values and callbacks as anonymous functions.

0 comments voice your opinion now!
object notation suggestion array parameter



Community Events











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


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

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