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

Laravelista.com:
JSON Web Token Authentication for Lumen
June 29, 2015 @ 12:07:36

The Laravelista.com site has a new tutorial posted showing you how to integrate JSON Web Tokens (JWT) into a Lumen application. JWTs provide a simple, portable way to share authentication and session information in a more robust way than just a single randomly generated token.

This is my third post on how to build an API with Fractal, but in this post I will be focusing on authentication using JWT (JSON Web Tokens). [...] In Build an API with Lumen and Fractal I have shown you a way of creating an API using Lumen and Fractal. In this post we will continue with the same project called Treeline and implement authentication and protected routes. Also at the very end of the post is a small chapter on when to use Lumen over Laravel.

They make use of the tymon/jwt-auth library to handle the actual JWT functionality including a service provider making it simple to integrate. They talk about "improving Lumen" by adding a configuration directory for the JWT package to put its configuration file. From there they add in the necessary facades and configuring the library itself. Next comes the actual authentication handling that, post login, generates the token and resending it along with each response. Finally, they show you how to set up the protection on routes and verifying the token contents on each request.

0 comments voice your opinion now!
lumen tutorial jsonwebtoken jwt tutorial integration provider authentication

Link: http://laravelista.com/json-web-token-authentication-for-lumen/

Luciano Mammino:
Symfony security authentication made simple (well, maybe!)
June 04, 2015 @ 10:36:41

Luciano Mammino has a quick post to his site with information that tries to help make Symfony authentication simple (well, maybe).

The Symfony2 security component has the fame of being one of the most complex in the framework. I tend to believe that's partially true, not because the component is really that complex, but because there are (really) a lot of concepts involved and it may be difficult to understand them all at once and have a clear vision as a whole.

[...] Going back to the Symfony2 security component, the point is that I found out difficult at first glance to get a clear idea of what is going on behind the scenes and what I need to write to create a custom authentication mechanism. So in this post I will try to collect few interesting resources that helped me understanding it better and a graph I drawn to resume what I learned.

He provides a good list to some of the other resources that helped him along the way including several blog posts and links to the Symfony "cookbooks" about creating custom providers. He also shares a graph showing the full flow of the Symfony authentication process including commentary about each step.

0 comments voice your opinion now!
symfony authentication simple resources graph flow provider

Link: http://loige.co/symfony-security-authentication-made-simple/

Binary Studio Blog:
Definitive Guide On Creating Custom Providers For Laravel OAuth2 Authorization
May 26, 2015 @ 12:45:12

A new guide has been posted showing you how to create custom OAuth2 providers for your Laravel application. In this case they wanted to hook the application in via Socialite to the VK social network but needed a custom connector to make it happen.

First of all let's say that social authorization is very popular and frankly speaking it's really handy tool. Surfing internet we can see a lot of sites and services which offer login with Facebook, Twitter, Google and other social networks. [...] If you're building your website in PHP using Laravel, probably you've noticed Socialite which provides OAuth / OAuth 2 authentication with Facebook, Twitter, Google, and GitHub. The most famous social network which provides OAuth2 authentication in Russian segment of the internet is vk. But there is a lack of such connector (provider) in Socialite library. Actually it's not a hard problem, so let's build new VkProvider on top of Socialite's components.

He starts with a brief look at the typical OAuth2 authentication flow between the social network and your application. From there it gets more vk.com specific. He shows how to set up the custom application on their side, updating your configuration with the credentials and installing Socialite. He then implements a "VkProvider" defining the required methods based on the interface. He then registers it as a "SocialiteServiceProvider" and uses it in a "login" request route.

0 comments voice your opinion now!
oauth2 guide custom provider laravel socialite tutorial vkcom russian

Link: http://binary-studio.com/2015/05/25/laravel-oauth2/

SitePoint PHP Blog:
Use Laravel Contracts to Build a Laravel 5 Twig Package
March 16, 2015 @ 11:52:13

The SitePoint PHP blog has a new tutorial posted showing you how to integrate Twig into a Laravel application with the help of the recently added "contracts" feature of the framework. Twig is a templating library that aims to be fast, secure and flexible for data output in multiple contexts.

Laravel 5 is finally out, and with all the awesome features it brings. One of the new architectural changes is the new Contracts Package. In this article we are going to understand the reasoning behind this change and try to build a practical use case using the new Contracts.

He starts with a brief look at what Contracts are and what it means to use them in a Laravel application. He then shows how to define the package installation (via Composer) to pull Twig in and register it with the application for future use. He creates a simple service provider to register Twig and return a new "TwigFactory" instance. This instance extends the "FactoryConnect" implementing the "ViewFactory" and, along with a custom "TwigView" object can be used just like you would normally output information via Blade.

0 comments voice your opinion now!
laravel contract twig output template handling provider interface

Link: http://www.sitepoint.com/use-laravel-contracts-build-laravel-5-twig-package/

Matt Stauffer:
Conditionally Loading Service Providers in Laravel 5
March 12, 2015 @ 10:16:35

Matt Stauffer has a new post to his site showing you how to conditionally load providers in your Laravel-based application with some additional code in the AppServiceProvider.

Since Laravel 5 flattened a lot of the environment-specific structures, much of the configuration that was once stored in different config directories for each environment has now moved into .env files. But one that can't just live in .env is the environment-dependent loading of service providers.

He starts with a look at the normal service provider loading process, using the application configuration and adding them to the "providers" list. This loads them every time a request is made, even if they're not needed. His solution adds some code to the "register" method in the AppServiceProvider class to check the environment (like "production" versus "dev") and loads different providers based on the result.

0 comments voice your opinion now!
condition load service provider laravel5 appserviceprovider register

Link: https://mattstauffer.co/blog/conditionally-loading-service-providers-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

Laravel News:
Debug Your App with the Laravel Debugbar
February 10, 2015 @ 09:34:12

The Laravel News site has a post introducing a tool you can use in your Laravel applications to help debug issues and performance, the Laravel Debug Bar.

The Laravel Debugbar by Barry vd. Heuvel is a package that allows you to quickly and easily keep tabs on your application during development. With a simple installation and powerful features the Debugbar package is one of the cornerstone packages for Laravel. The debugbar is already updated for Laravel 5 and I wanted to show you all the great features it includes.

The post includes instructions to get the debugbar installed (via Composer) and add it to your Laravel providers list. They walk through the basics of its features and screenshots of each. He also links you to the project documentation to provide more detail on each of the features.

0 comments voice your opinion now!
laravel debug debugbar toolbar library provider tutorial introduction

Link: https://laravel-news.com/2015/02/laravel-debugbar/

Mathias Noback:
Collecting events and the event dispatching command bus
January 13, 2015 @ 11:52:33

Mathias Noback has posted the next part of his command bus in PHP series today with a few suggestions about event handling and when it's a good idea to dispatch them.

It was quite a ride so far. We have seen commands, command buses, events and event buses. We distilled some more knowledge about them while formulating answers to some interesting questions from readers.

In this new post, his focus is on collecting the events that happen as a part of the command's execution. He uses his "UserSignedUp" event his his previous example and a "send welcome email" handler to show why it may not be the best idea to execute all events simultaneously. Instead, he recommends making use of event collections (a feature his SimpleBus library supports) to define "providers" that can collect the events that need to happen and delegate the execution of them one after the other. Example code is included all through the post of events, providers and commands that make use of this idea.

0 comments voice your opinion now!
commandbus command collect event provider dispatch tutorial

Link: http://php-and-symfony.matthiasnoback.nl/2015/01/collecting-events-and-the-events-aware-command-bus/

Acim.net:
Trait injection in Zend Framework 2
December 11, 2014 @ 11:55:56

Boban Acimovic has recently posted a tutorial showing you how to use traits in a Zend Framework 2 application to inject additional functionality into your pre-existing classes.

There are several tutorials on the Internet which explain how to use interface based dependency injection in Zend Framework 2. The idea is to make an initializer, figure out which interfaces a class implements and then inject appropriate dependencies using setters defined in the interfaces. Bad part about this is that in each class you implement such an interface you have to declare a property which would hold the injected object and also to implement the setter for it, which is defined in the interface, by the way. In order to simplify this further it is possible to write trait for each interface, but then why should not use just traits? Why do we need interfaces? Is this possible at all?

He includes some example code showing how to set up dependency injection for the traits (via a custom injector based on the "InitializerInterface") and make the autoloading easier. He shows how to add this to the provider configuration as an "initializer" and create the first example trait, a checker for data in user passwords. He then drops the functionality into a service class just by using the "use" keyword and the trait name.

0 comments voice your opinion now!
trait injection zendframework2 tutorial dependencyinjection service provider

Link: http://www.acim.net/2014/11/trait-injection-in-zend-framework-2/

Lorna Mitchell:
How to Choose PHP Hosting
October 10, 2014 @ 09:15:36

Lorna Mitchell has a new post today sharing some helpful hints to help you pick a good PHP hosting provider for your next application or website.

I've been thinking a lot about the state of hosting in PHP lately, mostly as a result of working with a few different clients on their setups (including one that bought brand new hosting a month ago and got a PHP 5.3.3 platform), and also being at DrupalCon and meeting a community who is about to make a big change to their minimum requirements. With that in mind, here are my thoughts and tips on choosing hosting.

She starts off with one of the bigger criteria she looks for in a host: the minimum PHP version available (some might have more than one, especially some PaaS). She suggests that even things like PHP 5.3 should be considered too old and should be passed over in favor of newer releases like 5.5 or even 5.6. She then talks about some of the benefits that come from using a newer platform and the current levels of adoption and performance by PHP version. Finally, she includes an unofficial list of hosts that have set themselves out as good, solid PHP-friendly providers, each with their own strengths and weaknesses.

0 comments voice your opinion now!
choose hosting provider paas dedicated version performance

Link: http://www.lornajane.net/posts/2014/how-to-choose-php-hosting


Community Events

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


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

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