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

Hannes Magnusson:
Query logging and profiling in MongoDB
September 18, 2013 @ 10:25:49

in a previous post Hannes Magnusson introduced the new stream handling notification feature in the MongoDB PHP extension. In his most recent post he elaborates on a subject mentioned in the previous post - query logging and profiling.

In my previous blog post I mentioned that the 1.5.0 release of the MongoDB driver for PHP has improved notification support using the PHP Notification API, and showed off a fairly useless (but fun) progress bar. Now its time for a little bit more practical examples using this system: Query logging and profiling.

He talks about some of the features in his pull request, including the new constants added to help make working with the logging on streams easier. He includes some sample code that handles the logging via an "update" callback function, parsing the log message type and save the related data to a class variable. An instance of this class is then assigned to the "notification" stream and passed in as an additional option when creating the MongoClient connection. He includes an example of querying a basic collection and how to extract the request information from the logging object instance.

0 comments voice your opinion now!
mongodb stream context tutorial log query profile notification api

Link: http://bjori.blogspot.com/2013/09/query-logging-and-profiling-in-mongodb.html

DZone.com:
External processes and PHP
February 14, 2013 @ 11:29:04

In a new tutorial over on DZone.com Giorgio Sironi talks about handling external processes in PHP and how to work with streams.

I've come to known a bit about spawning and monitoring new processes from PHP code, while working at Onebip and trying to contribute to Paratest. Here's what you need to know if you think exec() or executing everything in a single .php script is always enough.

He starts with a look at the differences between using things like exec and streams for handling the spawning of other processes. He shows how you have more control when you go with the streams option and process handling with the "proc_*" methods. He also touches on some other things to think about like stream blocking, sleeping and dealing with multiple execution streams (and switching between them).

0 comments voice your opinion now!
external process tutorial stream handling


Community News:
ZendCon Keynotes Live Stream
October 23, 2012 @ 08:27:35

If you weren't able to make it to this year's ZendCon conference (happening right now in Santa Clara, CA) you can at least get a little taste of it though their live video stream of the keynotes.

There's five sessions they'll be sharing via the stream starting today and running through the 25th:

  • Opening Keynote - Andi Gutmans (Zend)
  • Open Source Cloud Technologies - Jimmy Guerrero (Red Hat, Inc.), Adrian Otto (Rackspace) and Peder Ulander (Citrix Systems)
  • The Media Industry and Moving to PHP - Raghu Bala (Source Interlink), Brent Pearson (UBM Technology)
  • PHP in the Cloud: Choice, Scale, Code, Simplify - Simone Brunozz (Amazon Web Services)
  • Zend Framework 2 - Practical Experience from the Trenches - Matthew Weier O`Phinney (Zend Technologies), Shawn Stratton (Discovery Communications, Inc.), Evan Coury (SouthwestMedical.com) and Mike Willbanks (CaringBridge)

The Opening Keynote starts at 8:30am PDT, so keep your eyes here for that broadcast.

0 comments voice your opinion now!
zendcon12 live stream keynote broadcast conference


Paul Jones' Blog:
When Possible, Use File *Resources* Instead Of File *Names*
July 04, 2012 @ 14:10:49

In this new post to his blog Paul Jones makes a suggestion when you're working with files or external connections in your PHP applications - pass the resource, not the file/path name for more flexibility.

In testing the Aura.Http package, I have realized that it's much more flexible, testing wise, to pass around file resources (a.k.a. handles, pointers, or streams) than it is to pass around file names. When you do that, you can use a php://memory stream instead of attempting to touch the file system.

He shows how using this method can make it easier to test with a simple bit of refactoring by passing in the "php://memory" stream rather than the actual file reference. The comment (from Chris Hartjes) also suggests an alternative tool for working with tests that need the file system, vfsStream.

0 comments voice your opinion now!
file resource filename opinion unittest phpmemory stream


Joshua Thijssen's Blog:
PHPShout a shoutcast streamer in PHP
March 27, 2012 @ 08:36:55

Joshua Thijssen has a new series of posts to his blog about a new extension he's created for PHP that lets you stream music files to an IceCast server with only PHP.

To continue our journey in pointless, but nevertheless fun things to create, I've created a simple PHP extension that allows you stream music data to an IceCast server in pure PHP. For this I'm using the libshout3 library which can stream both MP3 or OGG/Vorbis data to multiple stream servers (including IceCast, ShoutCast etc). In this blog-post I will try to explain how I've created this extension, and off course, how you can use it.

The series is split up into four parts:

  • Part 1 - download and install (and some behind the scenes)
  • Part 2 - parts of the extension and a first test
  • Part 3 - populating the store, adding getters
  • Part 4 - creating setters and some other random functionality

You can find the source for this extension over on his gihub repository.

0 comments voice your opinion now!
shoutcast stream audio extension tutorial


VG Tech Blog:
Unit Testing with Streams in PHP
December 08, 2011 @ 09:13:28

On the VG Tech blog today there's a new post from André Roaldseth about using PHPUnit to test PHP streams, basing the assertions on the data rather than the functionality itself.

Using the memory/temporary stream provided by php:// stream wrapper you can create a stream with read and write access directly to RAM or to a temporary file [using "php://memory"]. This gives you the possibilty to write unit tests that does not rely on a specific file, resource or stream, but rather on data provided by the test itself.

There's no specific code examples here, but you can refer to the stream wrappers section of the PHP manual for more details on this and other handy built-in streams. Once created, it can then be used just as any other stream resource can. This could be useful to provide mocks in your testing, replacing any other stream-able resource with a "memory" or "temp" placeholder.

0 comments voice your opinion now!
unittest stream memory temp wrapper mock object


DZone.com:
Using a stream wrapper to access CouchDb attachments with PHP
April 28, 2011 @ 10:45:27

On DZone.com today there's a new post from Gonzalo Ayuso about using a stream wrapper to access CouchDb database directly from PHP (via a call to its local file).

Thanks to a comment in my last post (many thanks Benjamin) I've discovered that it's possible to create a stream wrapper in PHP (I thought it was only available with a C extension). It's pretty straightforward to create the wrapper. Of course it's only an approach. We can create more functionality to our stram wrapper but at least this example meets my needs.

His wrapper uses a client from his Nov framework to open the stream to the given path and gives read and write methods to work with the data inside the database. Code for the wrapper class is included as well as a bit of example code showing how it can be used with the custom stream protocol. You can find the complete code here.

0 comments voice your opinion now!
couchdb stream wrapper database tutorial


Community News:
PHP Community Conference Live Video Stream
April 21, 2011 @ 09:56:17

If you weren't able to make it to the PHP Community Conference, you're in luck! They're providing a live video stream from the event on OpenEvent.tv.

Check out today's schedule for more information what the sessions are and summaries of what they're about. This morning's sessions are tutorials from Lorna Mitchell (web services) and Matthew Weier O'Phinney (Mastering Zend Framework 2 Patterns).

You can also follow the official conference twitter account at @phpcomcon for the latest updates.

0 comments voice your opinion now!
phpcomcon11 community conference live video stream openeventtv


Gonzalo Ayuso's Blog:
Live video streaming with PHP
September 20, 2010 @ 08:46:06

In a new post to his blog today Gonzalo Ayuso talks about video streaming and PHP. Well, okay, not so much using PHP for playing the video, more for the security and streaming around the streaming feeds.

For example we want to show videos only to registered users based on our authentication system. Imagine we're using sessions for validate users. That's means we cannot put the media in a public folder and point our media player to those files. We can obfuscate the file name but it'll remain public. In this small tutorial We're going to see how to implement it with PHP.

Since the video stream he wants to deal with is a live one (and not a single video file that can be read all at once) he shows how to use the output buffering functions in PHP to output small chunks of the data at a time with the correct headers attached.

0 comments voice your opinion now!
video stream live feed tutorial output buffer


Gonzalo Ayuso's Blog:
Using a stream wrapper to access CouchDb attachments with PHP
September 06, 2010 @ 08:15:22

In his continuing look at using CouchDb as a file system, Gonzalo Ayuso has posted this third part in the group of articles about using streams to connect your scripts to the database instance.

I'm still working in my filesystem with CouchDb. After creating a library to enable working with PHP and CouchDB (see the post here), and after using Monkey Patching to override standard PHP's filesystem functions. I've created another solution now. Thanks to a comment in my last post (many thanks Benjamin) I've discovered that it's possible to create a stream wrapper in PHP (I thought it was only available with a C extension).

He includes the code for the stream connection wrapper, a pretty simple script that parses the string it's given and opens a read/write stream to the source. There's also a "url_stat" method that will return to you the size of the stream in bytes. Then you just register the wrapper and go about your normal file system calls to use the CouchDb directly.

0 comments voice your opinion now!
couchdb stream wrapper attachment tutorial



Community Events











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


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

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