Photon is a high performance micro PHP framework.

High performance
Photon is run behind Mongrel2 and is 3 to 10 times faster than Zend, Symfony and the best standard mod_php frameworks.
Photon does not try to do everything, the core is small, easy to understand and without magic.
Photon is delivered with a 100% test coverage.
Easily manage background tasks to send emails, index your content, perform long running jobs.
Message Passing
Built on top of ZeroMQ, you can integrate your Photon project with your business logic (Python, C/C++, Fortran with C, R with Python) easily.

Photon is a technology preview. It is not yet recommended to use it in production.

Why is Photon Different?

At the core Photon is a PHP application server. That is, your code is loaded once at the start and then never again until the next restart. This makes Photon fast without the need of APC.

An application server communicating over ZeroMQ means:

  • You can open long running connections to your backend.
  • You can easily start new workers on different hosts than Mongrel2.
  • You can run background operations just after sending the response to the client (index the content, send emails).
  • You can efficiently stream data to your clients (realtime chat, stats, etc.).

Frequently Asked Questions

Why a micro framework?

You start a framework, then you add components, then you add magic to hide the complexity of all the components you added, then you add helpers to work nicely with the magic. At the end, your PHP framework archive is bigger than the code of your webserver and most of the projects need to use 5% of it. So, a micro framework is a framework doing perfectly these 5%.

Soon, you will be able to downloads high quality components for your web application through the Particles Project.

Why targeting Mongrel2?

Mongrel2 is a very well designed, high performance server developed by pragmatic users who do not like bloated software. The use of ZeroMQ as the communication hub makes it extremely flexible while keeping the incredible performance. As a result, one can easily write part of a project with Photon and use other languages for some special parts. Oh, and the community behind Mongrel2 is really nice.

What is the interest of ZeroMQ?

ZeroMQ is a high performance messaging layer on top of TCP, IPC or PGM multicast. With ZeroMQ, you can easily get a worker to connect to the Mongrel2 server over your LAN, this makes extremely easy to distribute your workers on several systems with zero configuration. For example, you can migrate your workers from one host to another without downtime.

# Start Photon on server 1, all the load is handled by server1
you@server1:~/myproject$ hnu server start
# Start Photon on server 2
you@server2:~/myproject$ hnu server start
# Now the requests are spread over server1 and server 2
# Stop Photon on the first server
you@server1:~/myproject$ hnu server stop
# All the load is handled by server 2 without any downtime
# and no reconfiguration of Mongrel2.

Of course you can distribute the load over your workers with more than just a round robin pattern.

Why not just a Mongrel2 adapter for an existing framework?

To really take benefit of Mongrel2 one needs to have an asynchronous framework. With Mongrel2 you do not have the traditional one request get one answer approach. This means that the standard PHP SAPI, which needs for each request an answer, is not adapted. As all the current frameworks are using the one request, one answer approach, you cannot take full benefits of Mongrel2 with them. For example, you cannot easily create an MP3 streamer or a realtime chat application.

What is the release number convention?

  • 0.0.XX: will be the first alpha releases.
  • 0.1.0: will be the first beta release, you can expect a couple of beta releases to get the core components up and running.
  • 1.0.0: will be the first stable release.

Once the stable release will be reached, the formalism will be: MAJOR.MINOR.PATCH.

Photon Authors

Photon is a project of Loïc d'Anterroches for Céondo Ltd. Photon is licensed under the LGPL making it easy to integrate the code in other open source projects or closed source commercial applications.