Tell me more ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I've been working on this library for 2 years now and using on many websites with great success. And I decided to make it public, I can assure this is the best jQuery <=> PHP bridge library there is for PHP 5.3 at the moment. I've created the documentation using phpDocumentor 2, but people are shy and never leave any constructive criticism or areas that could be made differently/better, so I think the best would be in CodeReview I guess. It can submit complex forms with infinite nesting, can have nested JSON responses, can access the calling DOM element, can access any object in the browser or set any var or call any function in any global object.

The docs are here http://phery-php-ajax.net/docs

The demo is here http://phery-php-ajax.net/demo.php

Some sample code:

function data($ajax_data, $callback_data, Phery $phery)
{
    return
        PheryResponse::factory($callback_data['submit_id']) // submit_id will have #special2
        ->merge('scrollTop')
        ->data('testing', array('nice' => 'awesome'))
        ->jquery('div.test2')
        ->css(array('backgroundColor' => '#f5a'))
        ->animate(array(
                'width' => "70%",
                'opacity' => 0.8,
                'marginLeft' => "0.6in",
                'fontSize' => "1em",
                'borderWidth' => "10px"
            ), 1500, 'linear', PheryFunction::factory(
<<<JSON
function(){
    $(this).append("<br>yes Ive finished animating and fired from inside PHP as an animate() completion callback using PheryFunction rawr!");
}
JSON
    ));
}

Phery::instance()->set(array('remote' => 'data'))->process();

this function would be called from Javascript

phery.remote('remote');

Access the main site for the github repo. Thanks!

share|improve this question
1  
Could you include some code (not just links) to the question, please? Unfortunately (according to the FAQ) question without code are off-topic here. – palacsint Nov 17 '12 at 12:44
okay, will do, just a sec – pocesar Nov 17 '12 at 12:45
1  
Those "are you sure" prompts on the demo site are super annoying. One of the demos also returns a PHP parse error message. – ThiefMaster Nov 17 '12 at 12:49
alright, removed the are you sure. they were left overs when the library was in the very beginning ;) it's intended to return a parser error message, to show how to throw exceptions from either PHP side or Javascript side – pocesar Nov 17 '12 at 12:56
1  
As a reference to a similar project, take a look at now.js where you can call server-side JS from client-side JS and vice versa. Basically bridging two separate worlds. – Joseph the Dreamer Nov 17 '12 at 23:20
show 4 more commentsadd comment (requires an account with 50 reputation)

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.