Does there exist a PHP event observer framework - frameworks

I'm looking to create a re-distributable PHP script and provide the ability to extend the application with plugins. The basic architecture should work just like magento.
Is there a PHP event / observer framework available ?

I would expect each framework to handle those events in their unique way. I've implemented observer / events through object-level callback hooks which can be multi-purpose and higher performance than the Spl Implementation.

Related

Can we use the data loss protection mechanisms from sap.ushell in a standalone UI5 application?

I hope there is a way for either SAPUI5 or OpenUI5 as this would ease the development efforts to implement data loss protection. If there isn't, I would be interested to know the best alternative to implement similar behavior. I was thinking of maybe extending the sap.f.routing.Router and checking an application-level dirty flag before handling the navigation.
Before exiting the application, methods:
https://sapui5.hana.ondemand.com/1.71.38/#/api/sap.ui.core.Component/methods/onWindowBeforeUnload and https://sapui5.hana.ondemand.com/1.71.38/#/api/sap.ui.core.Component/methods/onWindowUnload
are worked out in the Сomponent of the application. In this method, you can call the hasPendingChanges method on the OData model to check for unsaved changes and show a dialog for user interaction.
You can also look in the direction of drafts, implemented on the BOPF or RAP frameworks. Then the state will be stored on the backend. But this is a global change of concept, which will affect the revision of the implementation of logic in the backend.

Event Handling in Joomla Custom Component

I want to ask expert joomla devs out there, about event handling(dropdown values etc.) On how is it coded? In .NET(VB/C#) there is a custom event handler for every control in the User Interface during development (e.g button1_click). Any references?
There are aspects to this answer.
Firstly, I need to make sue that you are comparing .net web development with Joomla web development here. I would be surprised that every click on a .net control can be hooked into with a callback architecture, but then again I am not a .net developer.
Joomla has an event trigger system, which can be used in conjunction with Joomla plugins, see here: http://docs.joomla.org/Plugin/Events
On top of this, many more complex components define their own events, good examples are jEvents and jSeblod
This isn't built in the core of Joomla! and you would need to write some JavaScript/jQuery to handle this.
Alternatively, you could look at the likes of RS Forms which allows conditional displays for many field types.

Javascript client for REST API

I am trying to write a Javascript client for a web application which provides a REST API to interact with the application. I want to do this in a very advanced way like with a proven stack of tools and methodologies available in Javascript.
Most of the guides about javascript client library development I found in the web are application oriented which have a view part( I mean HTML part ). What I needed is like a client library with some methods which can be used to develop web applications. So I don't want to depend this library with any other javascript library like JQuery, Backbone etc.
I have gone through lot of design patterns available in javascript, especially patterns mentioned in Learning JavaScript Design Patterns a book by Addy Osmani. And after all I got confused, I couldn't decide which one to follow.
What I have in mind is like following:
Initialize the library with some key and secret (This can be compared to declaring object for a class in php).
There will be a data persistence unit which will keep the authenticated user's identity over a predefined amount of time like sessions in php. User data will be stored in cookies or local-storage. Also there will be provisions to override the methods of this unit so that user can implement their own storage mechanism. A reference to this unit will also be passed during library initialization.
Keep a global request method which handles all the API requests associated with the library(This can be compared to a method of the main class in php)
Define all the API methods encapsulated into different units according to the area of application it dealing with. This each unit will have a constructor method which defines some default properties to the unit( This can be compared to defining models in php which will fetch or save data from the application with API ). Each of this unit can be inherited from a super unit which provides some default properties and methods.
After reading some blogs and articles I have decided to use yeoman for library development. May be I can use some yeoman community javascript library generators to start the development.
As I described above I think what I needed is like: a class which keeps a single instance throughout the application which can be used to refer all the models and functions in the models. For this may be I can go with the singleton module pattern, but I am not fully sure about how to make use of it to my requirement.
Any advice is greatly appreciated!

Is it possible to use Symfony2 web profiler bundle with Zend Framework 1 or other framework?

I have existing project written in Zend Framework 1, it is long term project, constantly developed and without possibility of migrating to ZF2. It would be really neat to use Symfony2 Web Profiler bundle in it.
Currently, in development, I am using zfdebug (https://packagist.org/packages/spekkionu/zfdebug) which is great, but bundle from Symfony2 has so much more to offer...
I managed to incorporate Composer into my application (in Bootstrap), so loading something with it should be no problem. Also I found package on Packgaist (https://packagist.org/packages/symfony/web-profiler-bundle) but to be honest - I don't know if it is even usable without Symfony2.
Thanks for any tips.
No, this is not possible. If you take a look at the requirements on packagist you see it requires symfony/http-kernel, symfony/routing and symfony/twig-bridge to work. That's because the way the WebProfilerBundle works:
It registers himself at the most common events, the events happening in the HttpKernel and Routing component. If he cannot register to these events, he will not be able to give you timer information.
Moreover, it uses another event to inject imself in your page, meaning that if you don't have that event, you will never see the bar.
And the bundle is using Symfony conventions and techniques, meaning that it cannot run on ZF conventions and techniques. This is why it is called a Bundle instead of a Component, components are stand alone, bundles aren't.

GWT CRUD GUI Model

Good day. I'm still learning GWT so please help me. I'm working on a project - Web Application with GWT on the Client Side. This app has lots of CRUD operations so I'd like to make a model for this. Can anyone suggest a prototype for my CRUD class?
CRUD on this app goes something like this:
When I clicked the Details button in a module, a popup will be shown that allows the user to do CRUD operations. This popup do have the module title, info on the selected item, and the buttons - Edit, New, Delete.
I have already finished building the base GUI for this project but I'm just starting to work on each module. I choose to begin on those module with CRUD operations. So, please help me and give your ideas on this project. Thanks in advance :)
Your question is a little bit general.
You probably have to deal with two questions which can be handled separately:
Communication with the backend.
GUI for CRUD operations
Communication with the backend:
It depends on which kind of backend you are using.
Java-backend:
For Java backends the recommended client-server communication protocol is RequestFactory.
Non-Java-backend: In case you are using a non-java backend (python, PHP, etc) you have to use RequestBuilder using JSON or XML (I would recommend JSON).
For mapping JSON/XML to DTO's and vice verca you can use different methods:
Third party tools like piriti which are based on GWT generators
Javascript Overlay Types (JSO)
GWT Autobean framework (which is used by RequestFactory btw).
GUI for CRUD operations
For mapping your DTOs to your UI and doing the CRUD operations you can do it either:
manually
with the Editor framework
I would recommend to use the Editor framework as it reduces the amount of boilerplate code
to move an object from your object graph to the UI and back.
The Editor framework works well with RequestFactory (RequestFactoryEditorDriver), Autobean (SimpleBeanEditorDriver) and Javascript Overlay Types.