Open Source

Community News: Packagist Latest Releases for 05.05.2013

PHPDeveloper.org - Sun, 05/05/2013 - 15:09
Recent releases from the Packagist:

Jackalope-jackrabbit 1.0.0 Beta 1 released

Planet-PHP - Sun, 05/05/2013 - 10:33

Yesterday i tagged version Beta 1 of jackalope-jackrabbit, our PHP Content Repository (PHPCR) implementation. PHPCR is an API to manage tree-structured data, modelled after the Java Content Repository JCR specification. Time to summarize what jackalope can do today. For people already familiar with Jackalope, I summarize the recent changes at the bottom.

State of Jackalope-Jackrabbit

The basic node API is implemented and working fully. You can do direct access to paths and walk the tree hierarchy and read and write data. All data types including binary streams are supported.
We do support the workspace and session write operations including cross-workspace synchronization of nodes.

Queries can be expressed in the JCR-SQL2 language as well as the query object model. Additionally, jackalope provides a fluent query builder on top of the query object model. Most features of query are supported, the exceptions being query parameters and storing a query as stored query.

Exporting the repository to the standard "system" format and also the "document" format works, as does re-importing any repository dump (including those generated by Java JCR implementations).

Node type definitions can be inspected and are used to restrict allowed data when used. Both the CND file format and the object model to define custom node types are supported.

The observation journal is a log of everything that happened in the repository since a specified timestamp. It can be filtered to just see events an application is interested in. Filtering is for example done by repository path and by type of event like adding, changing, moving or removing.

Versioning is implemented and working. You can make nodes versionable, create new versions, inspect the version history to see old versions and restore old versions. Activities and version labels however are not yet implemented.

Session scoped locks are implemented. They allow to block a node, and optionally its subtree, to synchronize operations.
We did not yet implement open scoped locks, but that should not be too hard to do.

Besides building PHP content management, Jackalope-Jackrabbit can also be used to connect PHP applications to the Java jackrabbit based systems Magnolia CMS and Adobe CQ (currently called Adobe Experience Manager)

A couple of optional PHPCR features are not (yet) implemented:

  • Permissions and capabilities: Checks whether the current user is allowed to do an operation
  • Same Name Siblings: multiple children of the same node each having the same name
  • Shareable nodes: would allow a node to have more than one parent
  • Access Control Lists (ACL), because Jackrabbit does not expose this feature over the remoting protocol jackalope uses
  • Lifecycle mmanagement
  • Retention and Hold
  • Transactions, because Jackrabbit does not expose this feature.

It is not a design decision not to support those features. We would be happy about contributions to those features, though right now we focus on stabilizing and improving the features already supported.

Changes Bootstrapping

The RepositoryFactoryInterface was defining static methods. This is not legal PHP but the interpreter accepted it. We changed them to class methods and require the factory to have a no-argument constructor. Instead of

Jackalope\RepositoryFactoryJackrabbit::getRepository()

you now need to do

$factory = new Jackalope\RepositoryFactoryJackrabbit; $factory->getRepository();

Workflows

Jackalope now supports the SessionInterface::cloneFrom method and NodeInterface::update methods. This allows to copy a node into a different namespace, modify it there and then synchronize the changes back. With this, you can build workflow concepts.

Observation

The observation journal now is now usable. We figured out how to only get the events you actually care about when using the skipTo method. You can now use jackalope-jackrabbit as a message queue.

CLI commands

You have now commands to move a node, to touch (= create) a node and properties and to list the node types present in your repository.
The CLI commands are reorganized to a logical naming schema. We grouped them by what they affect: phpcr:node:*, phpcr:workspace:* and phpcr:node-type:*. We now differentiate between workspace:purge that deletes the whole repository and node:remove that can only delete a subtree but never "/".

Truncated by Planet PHP, read more at the original (another 1251 bytes)

Categories: Open Source, PHP Community

Community News: Packagist Latest Releases for 05.04.2013

PHPDeveloper.org - Sat, 04/05/2013 - 15:08
Recent releases from the Packagist:

Development Security isn’t an Add-on

Planet-PHP - Sat, 04/05/2013 - 14:48

Thanks to O’Reilly’s “DRM Day” promotion yesterday, I picked up a copy of a book I’ve been meaning to but could justify because a) full price of the ebook is around $25 USD and b) it was written back in 2003 – almost ten years old! The book, “Secure Coding: Principles and Practice” is more of an overview of things to think about when it comes to secure development and less about specific language-related tips. What’s interesting to me is that, despite the book being 10 years old, it seems like the same challenges they were facing then, we’re still facing now.

Even the introduction reinforces something I’ve been trying to advocate in the PHP community for a while now – security is not an “add on” that you can drop in at the end of the development process. Security must be a part of the planning and architecture of your applications from the beginning. If you “go back and secure things” you’re doing it wrong. Now, this doesn’t mean you have to have some kind of security review process retrofitted into your SDLC. I know of lots of teams that have their workflow down and are cranking out the code and features like there’s no tomorrow. How does a team like this start “thinking secure” without having to add a lot of extra overhead? It’s pretty easy really – all it really takes is a shift in mindset.

When most developers I know start out on problems, they ask themselves questions to figure out how to start in on their solution. They wonder about things like the “best way to do it” or “the most efficient way” to get the job done. Their minds start filling up with object structure and SOLID principles, trying to find the best solution (and maybe even technologies) for the job. To start thinking secure, all it takes is one more question:

How can I break this?

Easy, right? Well, like anything else in development, one question always leads to at least 10 more. This one simple question sets you down the right path, though. It’s too easy to get focused on making things work and writing up unit tests that pass when everything’s good. I want to challenge you as a developer to do one thing in your next project. I want you to take a step back from the code – maybe grab a fellow developer to help – and look at the application from the outside and determine what could be exploited and where (the “attack surface“). A lot of times this is easier when you’re not neck deep in the code, so if you have doubts, find an outsider.

Here’s some related websec.io articles I hope can help get you in the right state of mind as you work to integrate secure principles into your development. There’s lots of other topics in there that devs would find useful, but this will get you started:

Let’s all help make the integration of security and development a thing of the past. Then, ten years down the line, people wil be reading books from 2013 and wonder what it was like “before”. :)

Categories: Open Source, PHP Community

PHP Unconference Europe

Planet-PHP - Sat, 04/05/2013 - 09:00
Categories: Open Source, PHP Community

Reddit.com: Zend2 vs Symfony2

PHPDeveloper.org - Fri, 03/05/2013 - 19:57

On Reddit.com there's a discussion happening comparing two popular and prominent PHP frameworks - Zend Framework 2 and Symfony 2.

For those that have used both frameworks, what one do you feel is a better overall framework? I tried ZF2 in beta and it seemed overly complicated to symfony but I don't know if its gotten better since then.

Opinions shared in the comments of the post include things like:

  • "So if you are learning for job prospects, go Zend. I love Symfony 2 though, its a joy to work with."
  • "It doesn't matter. Each has a strength and a weakness, and neither will go away. Pick one and use it, you'll be fine."
  • "I don't think there is such thing as a best framework as you should use the best tool for the job. I don't think MVC is the solution to all problems."
  • "Both are quite bloated but they have to be considering their target markets."

On the whole, the views are of the "best tool for the job" mentality - a good sign for the community and these two frameworks.

Link: http://www.reddit.com/r/PHP/comments/1dcqst/zend2_vs_symfony2

Phil Sturgeon: Testing and Contributing with Composer Packages

PHPDeveloper.org - Fri, 03/05/2013 - 18:47

Phil Sturgeon has posted a guide to his site about running tests and contributing back to packages that live in Composer.

While Composer has been around for a while now, many packages are still in their infancy (< 1.0) or sometimes are just not as feature filled as they could be. To be fair there is always more to be done. It can always do more, or do the same thing more efficiently. Whatever the case, pull requests are going to be a common thing for the PHP community to be doing to these packages and this needs to be done safely, with unit-testing. So, how do you run their test suite and add your own tests?

He includes a step-by-step guide to getting the environment set up to run the package's tests and how to add some of your own. He includes the commands to send the pull request back up to Github (on your own fork, of course) and how to use that same fork as your package resource until the main project is updated.

Link: http://philsturgeon.co.uk/blog/2013/05/testing-contributing-composer-packages

Sameer Borate: Efficiently Replicating RETS data to MySQL

PHPDeveloper.org - Fri, 03/05/2013 - 17:26

Sameer Borate has a new post to his site that shares how he converted a RETS database to MySQL with the help of a PHP library, PHPRETS.

A recent project of mine entailed replicating a RETS database on a local MySQL database server. The client had a new real-estate mobile search app in development and wanted to have a local copy of the RETS database for search queries instead of a remote RETS server. [...] Replicating RETS data rather than using the live version is slightly complex, however. In order to replicate the RETS data into your own local database, a series of processes are needed in order to make sure the data you have is both updated and in sync with the server.

He breaks it down into three main steps with some sample code for each:

  • Grabbing the complete database once
  • Keeping the data in sync
  • Ensuring the cron job is executed on regular intervals
Link: http://www.codediesel.com/data/efficiently-replicating-rets-data-to-mysql

Francesca Krihely: On the Developer Experience

PHPDeveloper.org - Fri, 03/05/2013 - 16:22

In a new post to her site Francesca Krihely starts looking at the developer experience - how developers relate to your service and product and what kinds of things you need to be doing to help engage them.

I had a great brainstorm a few weeks back with the members of the Developer Evangelists meetup on the topic of the User Journey, or as I'll call it now, the Developer Experience. The main problem we wanted to solve was how we convert new users into experts or awesoms users. In many ways, a Community Manager and/or Developer Evangelist is responsible for driving user adoption and making users successful, so this is a topic near and dear to all of our hearts. I walked away with three key things that help improve the developer experience: Great Product, Great Support and Empowerment.

This post talks about the first point - the "great product" - and notes that, if the product isn't useful and enjoyable to use, even developers won't bother with it. She also talks some about the need for quality documentation and how it can be seen as a sort of "marketing" to developers.

Work on making your product fit for an awesome developer experience. If you build it, they will come. Link: http://francescak.me/blog/2013/05/02/on-the-developer-experience

Community News: Packagist Latest Releases for 05.03.2013

PHPDeveloper.org - Fri, 03/05/2013 - 15:04
Recent releases from the Packagist:

Inviqa techPortal: Functionally Testing You Application Using Mink

PHPDeveloper.org - Thu, 02/05/2013 - 20:50

On the Inviqa TechPortal today there'a a new post from Konstantin Kudryashov showing you how to use Mink for functional testing (an extension of Behat) of you web application.

Automated testing is big news these days. There's hardly a PHP conference happening without a talk on testing automation or derivative methodologies. TDD (Test-Driven Development) and BDD (Behaviour Driven Development) are all around us. So why should you care about all this? [...] The more complex an application becomes, the harder it is to be sure that each new feature or bug fix won't break the system, and that decreases your overall confidence in your work as developer. That's exactly the reason why you need automated testing - to be confident that you're not breaking important parts of an application.

For his examples he uses a simple Silex-based application (found here on github) that just shows a main page and an "add article" page that returns a preview when submitted. He shows how to get Behat/Mink installed and how to bootstrap PHPUnit to allow you to execute your tests. Also included is a sample test that clicks the "Add Article" link, runs a few checks and fills in some data. The form is submitted and the "preview" page is checked for valid results.

Link: http://techportal.inviqa.com/2013/05/02/functionally-testing-your-application-using-mink

PHPMaster.com: Crop and Resize Images with ImageMagick

PHPDeveloper.org - Thu, 02/05/2013 - 19:14

PHPMaster.com has a new tutorial posted showing you how to crop and resize images with the help of the ImageMagick functionality that can be added to PHP (via this extension).

If your website allows users to upload photos, image cropping/resizing functionality certainly comes in handy. But users might not have access to image manipulation tools like Photoshop, so by providing a cropping/resizing feature you can allow users to upload photos from any device (e.g. tablets or phones) without them having to worry about the the final size. Furthermore, you can create different versions of the same image and also allow users to crop specific portions of uploaded picture. In this article I'll show you how to create an image cropping tool with the help of the ImageMagick PHP extension.

The post shows the use of the "cropimage" function to trim down an image from its original size and "thumbnailImage" to shrink down the image to make a thumbnail. Also included is the code (both the PHP and the HTML form) to handle file uploads and automatically create a thumbnail image. It outputs the image to the browser and asks the user to select the portion they want thumbnailed (with this jQuery plugin helping).

Link: http://phpmaster.com/crop-and-resize-images-with-imagemagick

MaltBlue.com: Use RouteMatch in Zend Framework 2 For Easy Routing

PHPDeveloper.org - Thu, 02/05/2013 - 18:14

In the latest to his site Matthew Setter takes a look at easy routing with RouteMatch in Zend Framework 2 applications. The RouteMatch component gives you better control over your routing and lets you define "match paths" for URL to Controller mappings.

Today using Zend Framework 2 RouteMatch, Router and Request objects, I show you an easy way to dynamically update the current route. It's almost painlessly simple. [...] Well, like most things in web application development, what starts out simply in the beginner often grows more complex over time. So too is my once simple route.

His "simple" route started getting a bit out of control when he added in some pagination to the page (and query for the path match). He wanted to figure out how to re-render data with the same filters but show the next page of data. He shows how to use the RouteMatch component to achieve just this. He creates a custom module with a "listViewToolbar" helper that lets you read the router, request and handle the parameters sent via the URL. The "invoke" method is called to render the toolbar in the page, complete with the new settings.

Link: http://www.maltblue.com/tutorial/use-zend-framework-2-routematch-for-dynamic-routing

SabreDAV acquired by fruux

Planet-PHP - Thu, 02/05/2013 - 17:58

Last week we have finished the talks to transfer ownership of the SabreDAV project to fruux.

I've been working at fruux as a lead-dev for some time now, and SabreDAV is really at the core of everything we do, so this was a logical and inevitable choice.

To me it's an important step. SabreDAV has been one of the very little things that have remained consistent in my life. This validates my work from the last 6 years a bit. In another way it feels a bit like I'm letting go something that's very important and personal.

However, I'll still be running the project so in reality the change for me personally is not that big :).

What's SabreDAV?

SabreDAV is an open-source project that I've started all the way 2007. It allows you to write WebDAV, CalDAV and CardDAV servers in PHP. These three technologies allow you to do file, calendar and addressbook syncing.

A few years ago steam really picked up, and it changed from the hobby project that it was back then, to something I could actually make a living off by doing consulting.

In 2012 I've took it one step further, and teamed up with fruux to build a commercial product around SabreDAV.

What will change?

Small stuff really. The GitHub urls have changed. The new project pages are:

A bigger change is that fruux will now be the official go-to place for commercial support. I feel this will strengthen the SabreDAV project, especially for the potential users that are into that sort of thing.

It also means that getting a new website is in the cards :). The current one has passed it's expiry date.

Does this mean SabreDAV will go closed-source?

No. I would never let this happen. SabreDAV will remain as open source as it has always been, and we also don't intend on making it crippleware.

The BSD license in place today is very liberal, and I feel that it's exactly this that has allowed many projects and businesses to adopt it. Taking that away would not only damage the project, it would also feel ethically wrong.

However, SabreDAV is primarily a library, suitable for integration into other systems. We're definitely looking into the possibility of offering a more complete package, such as a standalone server with solid management interfaces.

Thanks!

Thanks everyone for your continued support, pull requests and relying on SabreDAV for your projects :). It's the best reward, really.

If you're interested, also check out the announcement on the fruux blog

Categories: Open Source, PHP Community

Dougal Campbell: WordPress 10th Anniversary Blogging Project

PHPDeveloper.org - Thu, 02/05/2013 - 17:22

Dougal Campbell has a new post to his site with his own contribution to the "WordPress 10th Anniversary Blogging Project" - a remembrance of his history with the tool and where/when he first started using it.

The official 10th anniversary of the release of WordPress is May 27, 2013. It has been an amazing 10 years, during which WordPress evolved from a simple blogware to a very full-featured CMS (Content Management System), used to power some of the biggest and most popular web sites on the internet. All over the world, people are planning celebrations. As much as I like a good party, I thought this would also be a good time to celebrate WordPress by actually using WordPress - for blogging.

He talks some about when he got started with WordPress (2003) and what's happened since. He suggests that others follow suit and use the "#wp10" hashtag on Twitter to share their own posts.

Link: http://dougal.gunters.org/blog/2013/05/01/wordpress-10th-anniversary-blogging-project

Josh Adell: Serializing Data Like a PHP Session

PHPDeveloper.org - Thu, 02/05/2013 - 16:11

In this new post Josh Adell looks at working with PHP sessions and how you can manually encode data to look as if it came from the normal session handling.

If you have ever popped open a PHP session file, or stored session data in a database, you may have noticed that this serialization looks very similar to the serialize function's output, but it is not the same. Recently, I needed to serialize data so that it looked like PHP session data (don't ask why; I highly suggest not doing this if it can be avoided.) It turns out, PHP has a function that encodes data in this format: session_encode.

Unfortunately, this method doesn't take arguments - it just outputs the encoded version of the current session data. So, he came up with his own encode/decode methods that use the PHP session, extract the serialized string and return it.

Link: http://blog.everymansoftware.com/2013/05/serializing-data-like-php-session.html

Community News: Packagist Latest Releases for 05.02.2013

PHPDeveloper.org - Thu, 02/05/2013 - 15:01
Recent releases from the Packagist:

Functionally Testing Your Application Using Mink

Planet-PHP - Thu, 02/05/2013 - 12:49

Automated testing is big news these days. There's hardly a PHP conference happening without a talk on testing automation or derivative methodologies. TDD (Test-Driven Development) and BDD (Behaviour Driven Development) are all around us. So why should you care about all this? Well, there are many excellent reasons to do automated testing, including assuring application quality and inspiring developer confidence in a system. If you are a business person, you're most likely to care about the quality; if you're a developer then the confidence aspect is more important. The more complex an application becomes, the harder it is to be sure that each new feature or bug fix won't break the system, and that decreases your overall confidence in your work as developer. That's exactly the reason why you need automated testing - to be confident that you're not breaking important parts of an application.

Now you're convinced that automated testing is important, but isn't unit testing enough? Unit tests are cheap, fast and small. Why might you want to expand into using a technique such as functional testing? Once again the answer is confidence. The more complicated an application becomes, the more complicated the interactions between separate parts of the application become. Just as you can't be confident your car is roadworthy by manually turning each of its wheels independently, you can't be sure that an entire application is working by testing each of its units independently. You need functional testing for complex applications - and today, that's every application.

Silex

Silex is a PHP microframework based on Symfony2 components. It has rapidly become a popular tool in the Symfony2 community thanks to its simplicity and shallow learning curve. That said, the simplicity of Silex does not mean that it is only fit for simple applications, in fact the opposite is true. Some types of application, like RIAs (Rich Internet Applications) are better built with PHP and the minimalism of Silex.

As an application becomes more complex, so it becomes more important to properly test it. Silex provides some tools for functional testing using the Symfony2 BrowserKit component. This is useful, but what if some of of the application's functionality requires real HTTP requests to be made? Those could be done using a console browser emulator like Goutte. How about if some functions depend on AJAX to behave properly? Using Selenium or even Zombie.js could be a good option in that case.

There are two problems with all the solutions mentioned here:

  1. There's simply no single best choice in terms of browser emulation. Some emulators (BrowserKit, Goutte) are extremely fast, but don't support AJAX. Others (Zombie.js, Selenium) support AJAX but are much slower. In an ideal world, you would want to use multiple emulators at the same time, choosing the best one for each specific case. That leads us to problem #2.
  2. Different browser emulators are written in different languages (PHP, JS, Java), using different libraries and provide extremely inconsistent APIs for developers to work with. That means it is difficult to switch from one emulator to another as it will require all helpers and testing tools be rewritten.

Mink

To help solve some of these problems, a library called Mink was written. It was created originally as a complementary tool for Behat, but is not tightly coupled to Behat itself and so it can also be used with any framework or tool out there. Mink is a browser emulator abstraction layer - a tool that removes the differences between the various browser emulators and provides one single API through which you can control them all. This essentially means you can switch from browser emulator to browser emulator quite seamlessly as they all use the same PHP API. This article will show you how to use Mink to functionally test an example Silex application using a couple of different browser emulators.

Setting Up

As our test application we'll use a very simple Silex blog application that is already prepared for you. The code is on github at https://github.com/everzet/silex-mink so use that as your starting point.

Set Up the Test Suite

In order to install and integrate Mink, Silex and PHPUnit, some extra entries are needed in composer.json. The new sectio

Truncated by Planet PHP, read more at the original (another 37475 bytes)

Categories: Open Source, PHP Community
Syndicate content