SabreAMF 1.0 release
SabreAMF is now considered stable.. It has been tested for over a year, and no problems have been reported for a while.
I'm not totally sure where to go from here though; The original design goals have been met, documentation is written and it is well tested. Adding features for the sake of adding features doesn't seem like a good idea; so I guess this is where the project sort of halts..
I'll stick around to support and maintain it though.
Get it here. If you are running 1.0-beta4, don't bother (it's the same)
Comments
Theo •
Hooray!Darren •
Congratulations, Evert! I think it's fantastic that you have donated so much time to helping other programmers.Having a little bit of AMFPHP experience, I was up and running with SabreAMF (and Flex) in 5 minutes after reading Renaun's tutorial (http://www.adobe.com/devnet/flex/articles/remoteobject_sabreamf.html).
One thing I did have to do to get it working with my particular setup was to alter my includes path so that all the SabreAMF require_once's would work. The way I have my setup is to have all my common PHP libs stored in a folder within my PHP includes folder so that I can use them from any project. With this setup, all I need is a custom gateway.php, as well as services and vo folders, for each project and I can use the one installation of SabreAMF for every project. All I had to do to get this working was to include this line at the start of each project's gateway.php:
set_include_path( get_include_path() . PATH_SEPARATOR . get_include_path() . '/my__common_libs_folder/' );
I only mention this in case others wish to use a setup like mine. SabreAMF works fine out of the box as long as you put the files in their recommended locations.
Thanks again,
Darren.
Thijs Triemstra •
Congratulations with the release! It came a long way.Darren •
Another couple of observations about SabreAMF from someone moving across from AMFPHP (which may or may not be helpful to you):1. I found that I had to call SabreAMF_ClassMapper::registerClass before instantiating the SabreAMF_CallbackServer to get the mapping from Flex to PHP to work. I sort of anticipated that registerClass may need to be called before the onInvokeService listener was set but I was surprised that it had to be called even before the SabreAMF_CallbackServer was instantiated. So, using Renaun's code (DataServicesServer.php), this was the only order that worked for me:
public function __construct() {
SabreAMF_ClassMapper::registerClass('com.renaun.samples.vo.UserVO','UserVO');
$this->server = new SabreAMF_CallbackServer();
$this->server->onInvokeService = array($this,'invokeService');
}
This order of instructions wasn't clear to me from the docs and it also didn't occur to me straight away because if I set a listener for $onGetRemoteClass instead, this seems to work fine after the SabreAMF_CallbackServer is instantiated (which is where Renaun has it). Maybe it would be worthwhile mentioning in the wiki that 'SabreAMF_ClassMapper::registerClass' should be called before 'new SabreAMF_CallbackServer();' for Flex to PHP mapping to work. Or maybe this is obvious and I'm just a little slow.
2. Similarly, adding a listener using SabreAMF_ClassMapper::$onGetLocalClass only works if it is placed before "new SabreAMF_CallbackServer();' while SabreAMF_ClassMapper::$onGetRemoteClass works both before or after. By the way, I wrote this tiny getLocalClass function which seems to work well for Flex:
public function getLocalClass( $dataClassName ) {
$className = array_pop(explode(".", $dataClassName));
if(class_exists($className)) {
return $className;
} else {
return SabreAMF_ClassMapper::getRemoteClass( $dataClassName );
}
}
3. Is there a typo in line 118 of ClassMapper.php? Should it be:
throw new Exception('Classname received from onGetRemoteClass should be a string or return false. ' . gettype($remoteClass) . ' was returned');
I hope some of this is helpful.
I'm really liking SabreAMF. I hope to use it on most of my future Flex-PHP projects. If you do get AMFEXT working with your framework project, I hope you will consider making SabreAMF AMFEXT-compatible because at the moment the faster speed seems to be the only reason I would consider using AMFPHP on some bigger projects.
Cheers,
Darren.
Darren •
Oops, getLocalClass should be:public function getLocalClass( $dataClassName ) {
$className = array_pop(explode(".", $dataClassName));
if(class_exists($className)) {
return $className;
} else {
return false;
}
}
Evert Pot •
Darren,The behaviour you are seeing with adding the classmaps before or after instantiating the callbackserver is really really odd, as the logic only starts to kick in after a call to ->exec()
It makes me wonder there might be something else wrong in the logic of that code ??
As to your point about the typos in the exception being thrown, I just fixed that on SVN and will put out an update soon.. Good thing the error is in the error handling so it won't actually break any running apps..
Thanks a lot ! If you are interested in helping out with some of the wiki pages, please drop me a line.. my address is evert @ this domain..
Evert
cms •
Very fast new version. Great!Wil •
Hi, I'm wondering if there's a minimal example for using SabreAMF on the flash/flex side. The examples I found in the adobe site is too complex/intimidating for newbies like me.Wil •
Ahh nevermind, spent an entire day experimenting with the API and here's what I got: http://blogs.crammerz-inc.net/thunk/2007/12/31/getting_started_with_sabreamf some guidelines on the use/misuse would be helpful though...