News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

ServerGrove Blog:
Satis building your own Composer repository
April 30, 2015 @ 11:26:53

Composer has definitely made a huge impact on how PHP packages and libraries are integrated into other applications. Sometimes, though, it makes more sense for you to keep your code internal to the organization rather than have it public where Composer can install it. In this case, using some thing like Satis (a self-hosted Packagist-ish server) makes more sense.

We all love Composer. It changed dramatically the way we build PHP applications, based on small and reusable components, but this creates new challenges, especially when we have a single point of failure (SPO). With Satis, the deployment process can be made robust by adding redundancy in all potential SPOFs (Packagist and GitHub). Let's see how it works.

They start with a brief look at how Composer works for those not familiar, making the connection with Packagist and ultimately the public repository. In the context of the "single point of failure" they talk about Packagist being down and it preventing the install (or deployment!) of your application. Satis is prefect to help prevent this. The article then shows how to install Satis (via Composer, naturally) and how to set up the configuration file to define the repositories. The server is then built and can be run using the built-in PHP server on the port of your choice. They include a screenshot of the end result and a quick example of how to use it via your project's Composer configuration.

0 comments voice your opinion now!
satis tutorial packagist composer local server install configure repository

Link: http://blog.servergrove.com/2015/04/29/satis-building-composer-repository/

Phillip Shipley:
Creating a PHP Nexmo API Client using Guzzle Web Service Client - Part 3.5
April 13, 2015 @ 11:14:29

Phillip Shipley has continued his series about hooking your PHP application into the Nexmo API with this new update, part 3.5 of the series. It's a smaller follow up to the code and functionality introduced in part three with a quick implementation of some of the other API methods.

As I've hit on several times, using the Guzzle Web Service description way of developing an API client can save a lot of time. It took me a little less than an hour to finish adding support for these three sets of APIs. If I was writing every Guzzle client initialization and call individually it would have taken a lot longer I'm sure.

The process only takes four steps and the majority of that is just setup via Composer. In order to make things easier and so that you don't have to worry about the details of implementing each of the API features, he's just created a repository to bring all of that functionality in at once. He includes the code you'll need to add to use it as well (about the same as before, just with different client types).

0 comments voice your opinion now!
nexmo api tutorial series part3plus guzzle webservice client repository

Link: http://www.phillipshipley.com/2015/04/creating-a-php-nexmo-api-client-using-guzzle-web-service-client-part-3-5/

Remi Collet:
PHP 7.0 as Software Collection
March 26, 2015 @ 10:15:48

Remi Collet has a new post today talking about the next major release of the PHP language - PHP 7 - and how it, in its current state, can be installed now as an RPM from the "remi" repository as a software collection.

RPM of upcoming major version of PHP 7.0, are available in remi repository for Fedora 20, 21, 22 and Enterprise Linux 6, 7 (RHEL, CentOS, ...) in a fresh new Software Collection (php70) allowing its installation beside the system version. As I strongly believe in SCL potential to provide a simple way to allow installation of various versions simultaneously, and as I think it is useful to offer this feature to allow developers to test their applications, to allow sysadmin to prepare a migration or simply to use this version for some specific application, I decide to create this new SCL.

Instructions for the installation (via yum) are included and a list of some things "to be noticed" about the setup are also included.

0 comments voice your opinion now!
php7 software collection fedora enterprise linux rpm yum install remi repository

Link: http://blog.famillecollet.com/post/2015/03/25/PHP-7.0-as-Software-Collection

SitePoint PHP Blog:
How to Use GitHub's API with PHP
March 17, 2015 @ 10:11:39

The SitePoint PHP blog has a new tutorial posted showing you how to interact with the GitHub API via PHP thanks to the KnpLabs library to create a simple automation system to perform some simple tasks.

Github is one of the best ways to share code and collaborate. In this article, we are going to learn how to consume their API and how we can use it to accomplish some of our daily tasks. We are going to explore some of the daily tasks that can be accomplished through the Github API and build a small app using Laravel to illustrate the use cases. You can check the final result on Github.

They walk you through the setup of an application on the GitHub side and how to configure the related settings in your Laravel application. He shows how to bind the GitHub library to the app, set up some sample routes and build out controllers to:

  • List repositories
  • View repository content
  • Editing files
  • Viewing commits

Each item includes the code you'll need to make it happen, an example of the output you'll get from the API and how to use the data on your side in your views.

0 comments voice your opinion now!
github api tutorial knplabs repository edit view content commits

Link: http://www.sitepoint.com/use-githubs-api-php/

Bosnadev.com:
Using Repository Pattern in Laravel 5
March 11, 2015 @ 09:51:59

Mirza Pasic has posted a tutorial to the Bosnadev.com site introducing you to the repository design pattern and how to use it in a Laravel 5-based application.

These days there is a lot of buzz about software design patterns, and one of the most frequently asked questions is "How can I use some pattern with some technology". In the case of Laravel and the Repository pattern, I see often questions like "How I can use repository pattern in Laravel 4″ or nowadays "..in Laravel 5″. Important thing you must remember is that design patterns do not depend on specific technology, framework or programming language.

He starts with a brief overview of the Repository pattern, just to catch everyone up to speed (complete with a diagram for extra effectiveness). He then talks about the role interfaces play in the structure and where in the Laravel directory structure he recommends placing them. He configures the "composer.json" file to autoload them correctly and gets into his actual implementation. He creates a system to work with the push and pull of movie/actor/rental data including the code to make not only the specific repository instances but the generic class they inherit from. Next he creates the "criteria" object type to help with searching the data and makes a few examples ("length over two hours", "rental below three"). Finally he shows how to use this criteria searching in a controller to create custom queries and result sets.

0 comments voice your opinion now!
bosnadev repository designpattern laravel tutorial criteria interface

Link: http://bosnadev.com/2015/03/07/using-repository-pattern-in-laravel-5/

Programming Are Hard:
Structuring my applications, Cont'd
March 09, 2015 @ 12:03:16

The Programming Are Hard site continues its look at structuring Symfony-based applications in part two (it's just two parts) building on the structure and foundation laid out in part one.

It really irks me when I see some design/architecture decisions other developers have made but there's no technical explanation. What packages did they use? What challenges did they face? What trade-offs were made? I'll go over some more specifics in this post.

He recaps some of the things covered in the previous post first, ensuring everyone is on the same page. He then gets into the concept of "bundles" and how they encapsulate functionality. From there he talks about commands, controllers, dependency injection and lots of other topics, each with their own summary and a bit of code where needed for clarification.

0 comments voice your opinion now!
structuring application symfony bundle command controller di form provider repository resource serialize

Link: http://programmingarehard.com/2015/03/05/structing-my-application-contd.html

VG Tech Blog:
Using Local Packages as Composer Dependencies
November 25, 2014 @ 09:16:45

On the VG Tech blog this latest post shows you how to use local packages as dependencies in your Composer-enabled applications.

Composer changed pretty much everything when it comes to including dependencies in PHP projects. No more SVN externals or copying large library folders into your project. This is really great, but there's one thing I've been struggling to find a smooth process for; developing dependencies for your project. When implementing your project, the need for some module, library, service provider or something else will arise, and sometimes you'll have to implement it yourself. So, how to do that?

He starts with a list of three suggestions (including actually having the code in the project or mirroring the package) but suggests the last of the three: using a repository with a relative file system setup. He uses the "repositories" configuration option in the Composer config to define a "vcs" type and gives it a path to the package contents. He ends the post with the resulting output of the Composer install command, showing the package pulled in and being able to commit to it just like any other repo.

0 comments voice your opinion now!
local package composer dependencies tutorial repository

Link: http://tech.vg.no/2014/11/25/using-local-packages-as-composer-dependencies/

SitePoint PHP Blog:
Repository Design Pattern Demystified
June 02, 2014 @ 09:12:40

The SitePoint PHP blog has a new post today that hopes to "demystify" the Repository design pattern with an overview of its structure and ow your code can put it to use.

What is the Repository Design Pattern? To put it simply, it is an implementation of a brokering layer between the application and a data source. Neither party needs to be be aware of the other to perform their respective jobs which allows us to have a decoupled architecture which in turn helps in the scaling of the application in the big leagues without having hard dependencies.

He includes an example case where the Repository pattern might be used, to "proxy" requests to multiple types of data sources from many different inventory systems. He includes some pros and cons of using the functionality too, like a positive separation of concerns but a negative additional abstraction layer. The remainder of the post includes a code example basing it on a Laravel framework installation. He creates a simple Repository class and shows how to extend it with a layer specific to one city type.

0 comments voice your opinion now!
repository designpattern introduction tutorial laravel class

Link: http://www.sitepoint.com/repository-design-pattern-demystified/

Matthias Noback:
Inject a repository instead of an entity manager
May 19, 2014 @ 11:04:30

Matthias Noback has made a recommendation in his latest post about using a repository rather than an entity manager in your classes to inject dependencies.

It appears that I didn't make myself clear while writing about entity managers and manager registries yesterday. People were quick to reply that instead you should inject entity repositories. However, I wasn't talking about entity repositories here. I was talking about classes that get an EntityManager injected because they want to call persist() or flush(). The point of my previous post was that in those cases you should inject the manager registry, because you don't know beforehand which entity manager manages the entities you are trying to persist. By injecting a manager registry you also make your code useful in contexts where another Doctrine persistence library is used.

He suggests that more classes actually need a repository and not an entity manager to work with necessary objects. He also points out how the use of an entity manager can sometimes violate the Law of Demeter. He includes some code showing a refactoring away from an entity manager and towards a repository. He also has an example of a custom repository class based on the domain logic object types. In addition he talks about repository interfaces, resetting closed entity managers and "criteria" objects.

0 comments voice your opinion now!
repository entity manager doctrine refactor example

Link: http://php-and-symfony.matthiasnoback.nl/2014/05/inject-a-repository-instead-of-an-entity-manager/

Stephan Hochdörfer:
Speeding up your Satis run
May 02, 2014 @ 09:11:40

Stephan Hochdörfer has a new post with a handy tip on speeding up the indexing Satis does on your local repositories to generate its information. His tip involves being more selective in the rebuild process, only indexing the projects that might need it.

In the last couple of months this [indexing] process takes quite a while because Satis rebuilds the index for every repo it knows about. Since we deal with quite a few repos containing a large amount of versions it slowed down the "build time". Obviously it does not make any sense to run Satis on a repo that has not changed. Since Satis was lacking this feature I started hacking on it and I am happy that the feature got merged into master this morning.

With his patch, you can specify only the repository you want reindexed via the "build" command. You can even specify multiple repositories to rebuild, allowing for a bit more automation around the process.

0 comments voice your opinion now!
satis repository index speed performance patch single

Link: http://blog.bitexpert.de/blog/speeding-up-your-satis-run/


Community Events

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


composer opinion language example application project yii2 framework interview symfony api community conference php7 podcast series introduction list laravel part2

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