By Loïc d'Anterroches, xhtml.net, 18th of February, 2011
Organization of a Photon project. This includes the directory and file structure.
Conventions rule the directory structure. This means that in practice you can use any directory or file structure you want, but your code will be easier to maintain if you follow the conventions. The use of conventions over hard rules enforced at the code level means less code to maintain and most of the time better performance.
A website or a web application is a collection of components or
glued together in an URL space. For example, your website could be
composed of a series of small applications:
Of course, you may write each application by yourself or reuse applications from third parties, but the key is an application is small. An application just does one thing and does it well. You can have 200 applications in your website it will not affect performance at all.
Photon allows you to easily run background tasks. For example, a background task could be a small chat server which will notify each client when a message arrives or take care of sending an email to all your friends.
So, each web application is project composed of many apps which may provide tasks.
urls.php and the
views.php are in practice
needed. That is, you want to display something the views at a given
point in the URL space of your project the URL map.
If your application is only providing some tasks, you may have just
Yes, a task is very simple, it is basically just a small piece of code launched and monitored in the background by Photon. It listens on a given ZeroMQ socket for some work and send the results either directly as a synchronous task or not as an asynchronous task.