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

Symfony Blog:
How to solve PHPUnit issues in Symfony 3.2 applications
Dec 14, 2016 @ 17:53:49

On the Symfony blog there's a quick post sharing helpful advice about fixing PHPUnit tests in Symfony 3.2 applications, mostly around an issue involving the use of the "phar" distribution and a class constant error.

If your application uses Symfony 3.2 and you execute PHPUnit via its PHAR file, you'll end up with the following error message [about the "PARSE_CONSTANT" constant]. In Symfony 3.2 applications you can't use the PHAR file of PHPUnit and you must use instead the PHPUnit Bridge.

They provide the commands to get this bridge installed (via Composer) and how to execute the PHPUnit tests post-install (using the "simple-phpunit" command instead). They explain why this process needs to be followed to run the tests correctly and how the PHPUnit-bridge package helps to resolve the situation.

tagged: phpunit issue symfony v32 bridge constant error

Link: http://symfony.com/blog/how-to-solve-phpunit-issues-in-symfony-3-2-applications

Inviqa Blog:
An Introduction to PSR-7 in Symfony
Mar 18, 2016 @ 14:58:44

The Inviqa blog has posted a tutorial that gets in to the details of using PSR-7 compatible functionality in Symfony through the introduction of middleware into your application.

The PSR-7 standard, which describes common HTTP message interfaces, is a big step towards interoperability across different PHP libraries. The standard was introduced not long ago, but you can already use libraries compatible with this recommendation within your Symfony-based application.

[...] A step toward more homogeneity was achieved when the PHP Framework Interop Group accepted PSR-7 in May 2015. This recommendation describes common HTTP message interfaces. The biggest benefit the PHP community gets from the standard is a potential for interoperability across different PHP libraries. You can already use libraries compatible with this recommendation within your Symfony-based application thanks to the Symfony PSR-7 Http Message Bridge.

The tutorial then shows how to use this message bridge to convert the current Symfony HTTP request and response instances over to follow the PSR-7 structure (essentially a wrapper around it). They then show how to use this functionality in a simple Symfony controller, taking advantage of an event listener to automatically convert the request based on type hinting in the controller method. Finally they talk about middleware, what they are and how they fit into the flow of a web request/response structure.

tagged: psr7 symfony introduction middleware bridge request response controller

Link: http://inviqa.com/blog/2016/3/3/an-introduction-to-psr-7-in-symfony

PHP-DI:
Introducing the PHP-DI bridge for Slim
Mar 11, 2016 @ 16:15:24

In this new article on the PHP-DI project site they've shared one of the latest tools they've created to make it easier to integrate PHP-DI with the latest version of the Slim microframework (v3).

Slim 3 was released 3 months ago and it was significant. It is one of the first frameworks to integrate the latest standards and concepts in its core.

[...] While PSR-7 and middlewares are very interesting, what's more useful for us is the use of container-interop. That means Slim 3 can work with any dependency injection container. It is very easy to replace the default container (Pimple) with PHP-DI, but today we are releasing a "PHP-DI - Slim" bridge that goes a little further.

They then show how to use their new bridge to create controllers as services in the container and pass them parameters. The post ends with the instructions on getting the PHP-DI bridge installed and how to use it to replace the default AppSlim creation of your application.

tagged: phpdi dependency injection container slim microframework slimframework v3 bridge

Link: http://php-di.org/news/18-slim-bridge-released.html

Kévin Dunglas:
Using PSR-7 in Symfony
Jun 24, 2015 @ 17:50:56

With the recent acceptance of the PSR-7 HTTP standard by the PHP-FIG, there's been a lot of articles about using it in various PHP frameworks. In this new post Kevin Douglas looks at the use of it in Symfony, how it relates to the HttpFoundation component and when it will be included in the framework itself.

Back in 2011, Symfony 2 introduced the HttpFoundation component, a PHP library representing HTTP messages with an object oriented API. HttpFoundation is a key in the success of the HTTP-centric approach of Symfony, and it definitely inspirited the PSR-7 specification. However, PSR-7 and HttpFoundation differ fundamentally in two aspects: PSR-7 messages are immutable, mutability is in the DNA of HttpFoundation and in PSR-7, almost everything is stream.

Because of immutability it is very hard to make HttpFoundation embracing PSR-7 without a huge backward compatibility break impacting thousands of existing applications and bundles.

Work was almost immediately started to support the PSR-7 specification in Symfony, however. As a result support will be ready to be included in Symfony 2.7 but, as the rest of the post shows, it can be introduced in versions 2.3 or greater through a "HTTP message bridge" library. He shows how to get this installed in your Symfony application instance and how to use it in your controllers to interact with Requests and Responses. He does point out, though, that while this can bring your release up to PSR-7 status it comes with some overhead that may not be worth it if you're concerned about performance.

tagged: psr7 symfony bridge httpfoundation performance library

Link: http://dunglas.fr/2015/06/using-psr-7-in-symfony/

Symfony Blog:
PSR-7 Support in Symfony is Here
Jun 01, 2015 @ 17:19:15

The Symfony project has officially announced PSR-7 support in the latest version of the framework. PSR-7 is a recently approved standard by the PHP-FIG to make a more structured HTTP request and response structure (to aid in interoperability).

Less than 2 weeks ago, the PHP community roundly accepted PSR-7, giving PHP a common set of HTTP Message Interfaces. This has huge potential for interoperability and standardization across all of PHP. This is especially true for middleware: functions that hook into the request-response process. In the future, a middleware written around these new interfaces could be used in any framework. [...] Today, a huge number of projects use Symfony's Request and Response classes (via the HttpFoundation component), including Laravel, Drupal 8 and StackPHP.

[...] For that reason, we're thrilled to announce the 0.1 release of the PSR HTTP Message Bridge: a library that can convert Symfony Request and Response objects to PSR-7 compatible objects and back. This means that once there are middleware written for PSR-7, applications using HttpFoundation will be compatible.

The bridge makes it simpler to swap out the HTTP layer by converting the HTTP objects into something other frameworks can use (or so others can be used by Symfony). They provide some examples of how to put it to use, converting objects both to and from the standard Symfony HttpFoundation versions. There's also a quick note about the RequestInterface and ResponseInterface structure that allows you to bridge your own gaps between the PSR-7 friendly components and Symfony.

tagged: psr7 support httpfoundation request response http bridge phpfig

Link: http://symfony.com/blog/psr-7-support-in-symfony-is-here

Ibuildings Blog:
Integrating PHP And Java
Jun 02, 2010 @ 14:14:25

New on the Ibuildings blog there's a post from Ian Barber looking at the powerful combination of PHP and Java to make your applications even more robust.

There are many reasons to want to integrate these new developments with Java rather than just creating a separate silo - existing libraries or systems that would be difficult or expensive to replicate, well-tested systems providing key functionality, and an existing team of developers are just a few. So, the best way is often to mix and match the two - which is easier than it might first appear.

He looks at the four main ways to integrate the two technologies, some being a bit easier to implement than others:

  • Indirect integration (shared data source)
  • PHP on the JVM
  • PHP to Java (bridge)
  • PHP consuming Java services
tagged: integration javasc bridge jvm webservice

Link:

Alvaro Videla's Blog:
Erlang as a Fast Key Value Store for PHP
Mar 08, 2010 @ 19:37:51

Alvaro Videla has submitted a new post he's written up combining PHP and Erlang yet again, but this time he's using it to just store key/value pairs rather than for session data.

In this post I want to show you some of the neat things that can be done with the PHP-Erlang Bridge extension: A Key Value Store. Erlang comes packed with a Key Value store in the form of the ETS module. This is database is pretty fast and efficient for storing the Erlang terms in memory.

He tried a proof of concept to see how well the system would respond and was able to push over 150k items into the storage in one second. Sample code and instructions on getting the bridge working are included in the post.

tagged: erlang keyvalue store benchmark extension bridge

Link:

Liip Blog:
Jackalope - JCR for PHP started
May 12, 2009 @ 15:21:15

In this new post to the Liip blog Tobias Ebnother looks at Jackalope that's looking to bring JCR functionality into the toolset offered to PHP developers.

We initiated a new open source project called Jackalope. Its purpose is to bring JCR via Jackrabbit to the PHP world. [...] JCR provides a great standardized storage for hierarchical content and supports some nice features like full text search, versioning, transactions, observation, and more. Our main goal is to create a PHP Connector for Jackrabbit without using any Java.

To accomplish this, they're doing things in two steps. First, they've created a setup with the Java bridge (from Zend Server) to make the connection back to the Jackrabbit server and making writing tests to that API. The second step is to swap out the Java bridge with the Jackalope connection piece. You can check out the current state of the project on its Github page or come and ask questions of the team on the Freenode IRC network (#jackalope).

tagged: jackalope jcr zendserver java connect native bridge

Link:

Ant Phillips' Blog:
Integrating SAP NetWeaver in Zero PHP
Mar 20, 2009 @ 14:02:25

In a recent post to his blog Ant Phillips looks at how you can integrate the SAP Netweaver softare into Zero PHP (a Java PHP clone).

I thought it would be interesting to hook up a Zero PHP application with a SAP NetWeaver system. So last weekend I summoned up the courage and, armed with a bottle of red wine, set about the task. Surprisingly enough it wasn't too difficult (setting aside finding 20GB of disk space needed by the installer).

He talks about making the connection via SAP's JCo middleware component and the PHP/Java bridge that comes with the standard Zero installation. Code is included showing how to make the connection and grab information from the SAP data store.

tagged: zerophp java port sap netweaver integrate bridge jco

Link:

Ant Phillips' Blog:
PHP/Groovy Bridge
Jan 14, 2009 @ 16:23:46

In a recent post Ant Phillips looks at another bridge that's offered to combine PHP with another language (besides the Java one) - a link over to Groovy.

Up until recently the PHP runtime was treating Groovy code just the same as Java. Anyone could compile a Groovy class to Java class files using the Groovy compiler. Those class files could then be dropped into a Zero application and used in PHP through the PHP/Java Bridge. The problem is that Groovy isn’t the same as Java.

He compares the way its works when its Java-esque and how it should work as combined with the Groovy bridge. The code is much cleaner and, by making it more readable, makes it easier to maintain in the future. You can see some slides from a presentation hes given on the subject here.

tagged: groovy language bridge java example slides

Link:


Trending Topics: