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

Kévin Dunglas:
Using PSR-7 in Symfony
June 24, 2015 @ 12: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.

0 comments voice your opinion now!
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
June 01, 2015 @ 12: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.

0 comments voice your opinion now!
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
June 02, 2010 @ 09: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
1 comment voice your opinion now!
integration javasc bridge jvm webservice


Alvaro Videla's Blog:
Erlang as a Fast Key Value Store for PHP
March 08, 2010 @ 13: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.

1 comment voice your opinion now!
erlang keyvalue store benchmark extension bridge


Liip Blog:
Jackalope - JCR for PHP started
May 12, 2009 @ 10: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).

1 comment voice your opinion now!
jackalope jcr zendserver java connect native bridge


Ant Phillips' Blog:
Integrating SAP NetWeaver in Zero PHP
March 20, 2009 @ 09: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.

0 comments voice your opinion now!
zerophp java port sap netweaver integrate bridge jco


Ant Phillips' Blog:
PHP/Groovy Bridge
January 14, 2009 @ 10: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.

0 comments voice your opinion now!
groovy language bridge java example slides


PHPFreaks.com:
Design Patterns - Strategy/Bridge, Value Object, Singleton (Registry)
October 10, 2008 @ 09:33:10

Following up on their introduction to design patterns, the PHP Freaks have posted tutorials covering three of the more popular patterns - strategy/bridge, value object and singleton.

  • Strategy and Bridge - The Strategy and Bridge patterns provide solutions to apply polymorphism in more flexible way than you can accomplish with only inheritance.
  • Value Object - The Value Object pattern has, just like the Singleton, to do with referencing and instances. In a way, the Value Object is the opposite of the Singleton: it's goal is to ensure NOT to use the same instance, under certain conditions.
  • Singleton and Singleton Registry - The Singleton pattern ensures that you are always dealing with the same, single instance, wherever in your application. The Registry pattern usually utilizes the Singleton pattern (hence "Singleton Registry") to make the same 'globalness' apply to objects who's classes weren't necessarily designed to

Keep checking back to their tutorials section for more design pattern tutorials.

0 comments voice your opinion now!
design pattern singleton registry valueobject strategy bridge


IBM developerWorks:
Integrating Java and PHP in WebSphere sMash
October 01, 2008 @ 15:35:29

The IBM developerWorks site has this new tutorial posted showing how to combine two different languages, PHP and Jave, with the help of the Java bridge in the WebSphere sMash environment.

The WebSphere sMash environment enables rapid development of interactive Web applications based on popular Web technologies such as PHP, and it lets you reuse existing Java assets from PHP scripts. This article introduces the Java Bridge and shows how to access Java classes from PHP.

They create a sample project to work with in sMash and show how to implement and create a new the Java object that automatically loads and makes available to PHP the functionality inside. They look at accessing static methods and fields, catching exceptions, type conversion, and working with SQL connections.

0 comments voice your opinion now!
ibm java websphere smash bridge tutorial


PHPImpact Blog:
Building Web Applications Using PHP and Java
June 03, 2008 @ 13:42:39

This recent post on the PHP::Impact blog spotlights a useful little tool for those developers needing to span the gap between PHP and Java in their applications - the PHP/Java Bridge.

The PHP/Java bridge allows you to quickly access Java classes from within your PHP classes without having to know Java and vice versa. Because of this two-way flexibility, you can access hundreds of pre-built Java classes from PHP, and hundreds of pre-built PHP classes from Java opening up your applications to greater flexibility and enhanced functionality.

The post includes an introduction to the bridge's functionality - its functions/methods, how to make a new instance of it, catching exceptions and the type conversion it automatically does (like lang.java.String directly to the PHP String type).

They also mention the Zend Platform bridge functionality for a more commercial solution.

0 comments voice your opinion now!
application build java bridge phpjavabridge zendplatform



Community Events

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


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

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