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

Nils Adermann:
Composer Replace, Conflict & Forks Explained
February 19, 2014 @ 12:56:41

Nils Adermann has a new post looking at a problem with Composer where it will install a fork of a project rather than the actual project repository. He points out that it is not a security vulnerability in Composer itself, and is usually cause by using the configuration incorrectly.

Recently there has been an increase of cases in which Composer installs a fork of a package instead of the package the user expects. Most frequently these are forks of packages using a "replace" statement in their composer.json. These forks are usually meant for private use only but are still published on Packagist.

The issue stems from the use of "replace" and the publishing of those forked repositories in the Packagist service. "Replace" is meant to define a fork that is still compatible with the original project. The way that Composer handles finding the correct package to install can cause a conflict and the wrong package could end up "winning".

0 comments voice your opinion now!
composer replace fork repository dependency install

Link: http://blog.naderman.de/2014/02/17/replace-conflict-forks-explained

Lorna Mitchell:
Use a GitHub Branch as a Composer Dependency
February 19, 2014 @ 11:48:53

Lorna Mitchell has a quick post to her site today showing you how to use a GitHub branch as a Composer dependency when the need arrises for something other than master (or whatever branch is "stable" for the project).

My current project sees Celery (a python distributed task queue) added to my PHP application. There's a handy PHP interface to the RabbitMQ that Celery uses as a backend, which makes it easy for me to create jobs, called celery-php. This requires either the PECL AMQP extension< or alternatively it has experimental support for the PHP library for AMQP - I would normally prefer the PECL version but ran into version compatibility problems, missing manual pages, and decided that a pure PHP solution might be more portable and perhaps I would just add the experimental branch to my composer.json file for this project.

She includes an example of what the "composer.json" file would look like to pull this other branch. Two pieces of data have to be defined - the URL for the repository (to prevent Composer from trying to find it) and the branch name in the "require" section where the version would normally be.

0 comments voice your opinion now!
github repository branch composer dependency

Link: http://www.lornajane.net/posts/2014/use-a-github-branch-as-a-composer-dependency

PHPClasses.org:
Speedup Your Web Deployments Using Composer to Install PHP Classes Packages
December 12, 2013 @ 11:43:01

On the PHPClasses.org site today Manuel Lemos has a new post showing how you can use Composer in your deployments to help install packages from the PHPClasses site.

You can install one or more packages from PHP Classes, JS Classes or other Composer repository sites. [...] To make it simpler for you, PHP Classes and JS Classes generate a sample composer.json file for each package available in the Composer repository. Just go in the page of the package you want to install and click on the Install with Composer link.

He includes a brief guide on installing Composer and an example of the resulting "composer.json" file when you click on a link in a package. He points out the use of logins (depends on the package maintainer) and the use of an "auth.json" to automatically provide this information.

This is a great example of how a site that puts the Composer ecosystem to work to provide packages outside of Packagist. Composer, by default, relies on Packagist for its package information, but you can provide alternate repositories too - including using something like Satis for local packages.

0 comments voice your opinion now!
phpclasses composer install repository custom

Link: http://www.phpclasses.org/blog/post/221-Speedup-Your-Web-Deployments-Using-Composer-to-Install-PHP-Classes-Packages.html

NetTuts.com:
The Repository Design Pattern
November 26, 2013 @ 11:53:16

While design patterns are a wider topic than just PHP, the NetTuts.com site has posted a new tutorial looking at the Repository Pattern and uses PHP and PHPUnit to illustrate how the pattern works. They looks at the structure of the pattern at a high level and provide a more "real world" example too.

The Repository Design Pattern, defined by Eric Evens in his Domain Driven Design book, is one of the most useful and most widely applicable design patterns ever invented. Any application has to work with persistence and with some kind of list of items. These can be users, products, networks, disks, or whatever your application is about. If you have a blog for example, you have to deal with lists of blog posts and lists of comments. The problem that all of these list management logics have in common is how to connect business logic, factories and persistence.

They start with an overview of the pattern and some of the problems that it can help to solve. They also briefly mention the Gateway pattern that will be used in the examples to pull information into the Repository. After covering some of the basic concepts, they get into the code (going the TDD route) showing how to manage comments, like from a blog, inside a repository. It implements a "Comment" class, a persistence mechanism (the Gateway) and a Factory class that takes in the comment data and returns a correctly formatted object. Finally, they make the repository class and show how to add and retrieve comments from its internal data set.

0 comments voice your opinion now!
designpattern repository gateway factory persistence tutorial

Link: http://net.tutsplus.com/tutorials/php/the-repository-design-pattern/

Hasin Hayder:
Install and Run Symfony 2.3.6 projects in OpenShift instances in just one minute
October 28, 2013 @ 10:32:36

Hasin Hayder has a new post today sharing a boilerplate configuration and setup he's created to get Symfony2 running on OpenShift in "just one minute". OpenShift is RedHat's platform as a service that makes it easier to set up and deploy web apps.

Okay, I have written an article 2 days ago where I went through every details. But today. I have created a blank symfony container with all the necessary deploy hook and mods so that you can get your symfony 2 project up and running in an openshift container within a minute, fully automated, seriously!

This repository helps you set up the Symfony instance that's ready to go. He walks you through the steps you'll need to create the OpenShift "gear" and configure it to work with Symfony and MySQL.

0 comments voice your opinion now!
symfony boilerplate repository openshift instance configure install

Link: http://hasin.me/2013/10/27/install-and-run-symfony-2-3-0-in-openshift-instances-in-just-one-minute-with-this-boilerplate-repository/

David Adams:
Is ORM abstraction a pipe dream?
October 23, 2013 @ 09:59:21

David Adams has published a recent post that wonders if ORM abstraction is a "pipe dream" when it comes to abstraction. ORM stands for "object relational mapper" and is commonly used as a layer between the application and a dta source to work with the data as objects, not directly with it. He instead investigates replacing the ORM layer with multiple instances of repository pattern-structured code to abstract thing even more.

I was recently introduced to the repository pattern, a type of abstraction and organizational technique. The idea being, create a repository for each of your models to retrieve and persist to and from. A supposed benefit of the repository pattern is the ability to abstract your ORM and create different implementations for Eloquent, Doctrine, Propel, etc. This abstraction intrigued me. I set off to put this idea into practice and see what it took. Here are my findings.

He looks into how Doctrine handles its entities and tries to mimic some of the logic, including the calls to "save" and "flush". He also looks at how to handle a few other common ORM-ish topics like relationships, validation and observers. Unfortunately, he hit a wall with his solution and wasn't able to figure out a good Repository-based solution.

0 comments voice your opinion now!
repository designpattern proofofconcept orm object mapper doctrine entity

Link: http://programmingarehard.com/2013/10/21/is-orm-abstraction-a-pipe-dream.html

Wojciech Sznapka:
Injecting repositories to service in Symfony2
October 17, 2013 @ 11:45:54

Wojciech Sznapka has an interesting new post to his site today talking about injecting repositories into services in Symfony2-based applications. By injecting just a single repository instead of the entire EntityManager, you get a cleaner, more clear interface defined in the code.

It is generally a good idea to wrap business logic into services. Often, such services methods uses doctrine's repositories to operate on data storage. Injecting whole EntityManager service is very popular approach, but it isn't the most elegant way I could think of. EntityManager works only as a factory in that case and could lead to usage of other repositories, which might end up with too many responsibilities of given service.

He includes some code to illustrate his point - both a "services.xml" configuration of the related dependency injection container and a custom entity repository (defined in the config). He then shows how this repository (FooRepository) would be injected into the service (FooService) via constructor injection.

0 comments voice your opinion now!
symfony2 repository injection configuration tutorial entity manager

Link: http://blog.sznapka.pl/injecting-repositories-to-service-in-symfony2/

Symfony Blog:
The symfony.com website... in your language
June 11, 2013 @ 09:23:43

On the Symfony blog there's a new post mentioning the availability of the static contents of the Symfony site as a public repository.

The Symfony website has always been in English as English is probably the lingua-franca for web developers. But as some sections of the website do not change that frequently (mainly the "What is Symfony?", "Get started", and "About" sections), and because not all developers are comfortable reading English websites, I'm very happy to announce that most of the static contents are now available in a public Git repository.

They've already had people contributing back to the documentation in their own languages including German, Slovak, Czech, Swedish and Polish. Some of them are still works in progress, but they're getting there.

0 comments voice your opinion now!
symfonycom website language translation github repository

Link: http://symfony.com/blog/the-symfony-com-website-in-your-language

PHPMaster.com:
Listing Packages on Packagist for Composer
April 24, 2013 @ 11:57:49

Composer has changed how PHP developers work with external libraries and packages in even just the small amount of time its been around. One of the keys to its use, though, is getting your code listed on the Packagist site for easy requesting. In this new tutorial on PHPMaster.com, they walk you through doing just that.

You've created an awesome library, and now you're ready to open source it and share it with the world. Hopefully someone else can benefit from your work, and maybe you'll even receive a bug report or patch to make the library even better. But none of that can happen unless people can find itů and the modern way is increasingly becoming through Composer and Packagist. In this article I'll show you what information is needed in your composer.json file and how to list your library on Packagist so others can easily find it.

He talks some about the "composer.json" file for your project and talks some about the content that has to be there for Packagist to be able to pick it up correctly. He then shows you how to go over to the Packagist website, log in and add a package to their repository. It then shows you where on Github you'll need to go to set up a Service Hook to talk back to Packagist when a new version is deployed.

0 comments voice your opinion now!
listing package composer packagist tutorial repository

Link: http://phpmaster.com/listing-packages-on-packagist-for-composer

Magnolia CMS:
Recording Connect PHP Applications with Magnolia CMS through PHPCR
March 14, 2013 @ 11:17:08

Vikram Vaswani passed on a link to a recording of a webcast the folks over at Liip did about using the PHPCR (content repository for PHP) along with the Magnolia CMS.

PHPCR enables developers to use Magnolia CMS within a PHP application. Common scenarios include editing Magnolia CMS pages and creating or updating CMS page properties through a PHP front-end. With PHPCR and the PHP Jackalope implementation, PHP developers can interface with Jackrabbit, the JCR implementation in Magnolia CMS and can connect their Web applications with Magnolia CMS without any special Java training or knowledge.

You'll need to register to view the webinar, but it's an interesting look at integrating this (PHPCR) with a major system to house its content.

0 comments voice your opinion now!
magnoliacms phpcr content repository webinar recording



Community Events











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


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

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