SitePoint Sponsor

User Tag List

Page 1 of 5 12345 LastLast
Results 1 to 25 of 112

Thread: Zend Framework

Hybrid View

  1. #1
    SitePoint Guru
    Join Date
    May 2005
    Location
    Finland
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Zend Framework

    I thought a thread of its own would be in order.
    Zend Framework Website Launches

    We are glad to finally unveil the Zend Framework project. We have worked hard in the past few months with our partners and the community to get to this stage. We believe the Zend Framework can already be of great use to PHP developers, although we still have a lot of work ahead of us.

    This site will be the home to project related information such as downloads, the manual, and project updates. We will also put up instructions next week for how to access the Subversion repository so that you can play around with code as it's being developed (for better or for worse).

    The first preview release of the Zend Framework is available for download.
    Contained modules (of varying completeness):
    • Zend
    • Zend_Db
    • Zend_Feed
    • Zend_HttpClient
    • Zend_InputFilter
    • Zend_Json
    • Zend_Log
    • Zend_Mail
    • Zend_Mime
    • Zend_Pdf
    • Zend_Search
    • Zend_Service
    • Zend_View

    Check out some snippets from the included manual:

    Zend_Db_DataObject
    PHP Code:
    require_once('ZActiveRecord/ZActiveRecord.php');

    // Create a ZDBAdapter for ZActiveRecordBase.
    $db = new ZDBAdapterMySQL(array('host'     => 'localhost',
                                    
    'username' => 'user',
                                    
    'password' => 'password',
                                    
    'database' => 'test'));

    ZActiveRecord::setDatabaseAdapter($db);

    class 
    Person extends Zend_Db_DataObject {}

    /**
     * Calling the save() method will successfully INSERT
     * this $person into the database table.
     */
    $person = new Person();
    $person->nameFirst     'Andi';
    $person->nameLast      'Gutmans';
    $person->favoriteColor 'blue';
    $person->save(); 
    Zend_Db_Select
    PHP Code:
    require_once 'Zend/Db.php';
    $params = array (
        
    'adapter'  => 'pdoMysql',
        
    'host'     => '127.0.0.1',
        
    'username' => 'malory',
        
    'password' => '******',
        
    'dbname'   => 'camelot'
    );

    $db Zend_Db::factory($params);

    $select $db->select();
    // $select is now a Zend_Db_Select_PdoMysql object

    // SELECT *
    //     FROM round_table
    //     WHERE noble_title = "Sir"
    //     ORDER BY first_name
    //     LIMIT 10 OFFSET 20
    //

    // you can use an iterative style...
    $select->from('round_table''*');
    $select->where('noble_title = ?''Sir');
    $select->order('first_name');
    $select->limit(10,20);

    // ...or a "fluent" style:
    $select->from('round_table''*')
           ->
    where('noble_title = ?''Sir')
           ->
    order('first_name')
           ->
    limit(10,20);

    // regardless, fetch the results
    $sql $select->__toString();
    $result $db->fetchAll($sql);

    // alternatively, you can pass the $select object itself;
    // Zend_Db_Adapter is smart enough to call __toString() on the
    // Zend_Db_Select objects to get the query string.
    $result $db->fetchAll($select); 
    Zend_Json
    PHP Code:
    // Retrieve a value:
    $phpNative Zend_Json::decode($encodedValue);

    // Encode it to return to the client:
    $json Zend_Json::encode($phpNative); 
    Zend_Mail
    PHP Code:
    require_once 'Zend/Mail.php';
    $mail = new Zend_Mail();
    $mail->setBodyText('This is the text of the mail.');
    $mail->setFrom('somebody@example.com''Some Sender');
    $mail->addTo('somebody_else@example.com''Some Recipient');
    $mail->setSubject('TestSubject');
    $mail->send(); 
    Zend_Service_Rest
    PHP Code:
    require_once 'Zend/Service/Rest.php';

    try {
        
    $rest = new Zend_Service_Rest();

        
    $rest->setURI('http://example.org');

        
    // Returns a Zend_HttpClient_Response Object
        
    $response $rest->restGet('/services/rest''foo=bar&baz=bat');

        if (
    $response->isSuccessful()) {
            echo 
    $response->getBody();
        } else {
            echo 
    '<p>An error occurred</p>';
        }
    } catch (
    Zend_Exception $e) {
            echo 
    '<p>An error occurred (' .$e->getMessage(). ')<p>';


  2. #2
    SitePoint Guru
    Join Date
    May 2005
    Location
    Finland
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My own thoughts? Interesting. Definitely interesting. Its previewness is rather evident, though. The manual says nothing of Controller, for instance, but the package is still provided with the framework download. There's Zend_Controller, Zend_Controller_Front, Zend_Controller_Dispatcher, Zend_Controller_Router...

  3. #3
    SitePoint Zealot logitron's Avatar
    Join Date
    Feb 2006
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm...looks like nothing more but a bunch of PHP classes. :-P

  4. #4
    SitePoint Zealot
    Join Date
    Oct 2004
    Location
    Worcester
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree that it's interesting. Not sure what happened to "extreme simplicity" though as the front controller at least is pretty standard from what I can tell...

    As I said on the other thread, I've played a bit with the Front Controller and it fits together fairly easily (I wrote up my first attempt at www.akrabat.com). The FC is setup by default so that you have a controller class with functions for each action. i.e. http://localhost/blog/view ends up at BlogController::view(). I haven't yet worked out how the Zend_View class fits in though...

    It's not a lot different from the way I've been playing with a front controller recently. The question is what do I gain by using the ZF one rather than my own. It's not like there's so much code in a FC that maintenance will be a big issue...

    As Selkirk noted, the active record is missing from the download which is a shame as I want to poke around that bit! It's a certainty that I'd rather use someone else's orm because there's more obviously upgrades and enhancements that can be shared.

  5. #5
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ezku
    I thought a thread of its own would be in order.
    A whole series of topics, probably. I think there will be a lot to discuss and the framework will be bound to evolve once more pairs of eyes get a chance to assess it.

    I've only had a quick glance at a few classes so far. InputFilter seems to stack up every validation rule under the sun in separate methods of a single class. Perhaps it would be better to have a look at the Specification pattern, discrete Rule classes and policies.

    (PS: Jason's Php Architect's Guide to Design Patterns has a section devoted to this for anyone interested in learning more).

  6. #6
    SitePoint Wizard Ren's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    1,060
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ZSearch is quite good so far, indexed 5,200 documents, and seems to be searching fine, thou lacking a cache for the results, which would've been very useful.

  7. #7
    Where's my title at? dreaz's Avatar
    Join Date
    Apr 2004
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone else can't get the demos to work?

    All web services demos:
    Fatal error: Undefined class constant 'HOST_ALLOW_DNS'
    ZSearch:
    Fatal error: Exception thrown without a stack frame in Unknown on line 0
    I have both incubator and library on my include_path and I'm using PHP 5.0.5

  8. #8
    What a twist! Kings's Avatar
    Join Date
    Jul 2002
    Location
    The Netherlands
    Posts
    954
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dreaz
    Anyone else can't get the demos to work?

    All web services demos:


    ZSearch:


    I have both incubator and library on my include_path and I'm using PHP 5.0.5
    To fix the constant not defined problem:

    In Zend/Uri/Http.php, on line 373, change Zend_InputFilter to Zend_Filter both times, so that the line becomes:

    $allow = Zend_Filter::HOST_ALLOW_DNS | Zend_Filter::HOST_ALLOW_LOCAL;

    But even so, after that I couldn't get the Zend_Feed object working. Gave me a few other errors.

    So far I'm not really impressed with the framework, and it still feels very buggy to me. I couldn't get much working, and even the demos gave problems. But if they work out the problems, it looks to be a really good framework.
    Dennis Pallett - NoCertainty - My Personal Weblog
    The Web Network: ASPit | PHPit | WebDev-Articles
    Blogs: TalkFones | Holidayzer | PHPit Blog

  9. #9
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Umm...

    Had a look through the download earlier and there is one thing missing from it... Where are the unit tests?

  10. #10
    SitePoint Wizard Ren's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    1,060
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    Umm...

    Had a look through the download earlier and there is one thing missing from it... Where are the unit tests?
    "I agree. I was actually hoping they will be part of this release.
    Must have slipped by." - Andi Gutmans on the framework mailinglist

  11. #11
    SitePoint Guru thr's Avatar
    Join Date
    Jun 2003
    Location
    Sweden
    Posts
    664
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kinda disapointed that the put the ZendDBDataObject (thier AR implementation) in the Manual, but didn't put it in the .tar.gz file ;/. Other then that it looks quite nice, much better then your avarage pvp framework.

  12. #12
    SitePoint Guru
    Join Date
    Nov 2002
    Posts
    841
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Andi responds about Zend_Db_DataObject on the mailing list:
    This is actually some documentation that stuck around from our ActiveRecord implementation. We have currently decided to first focus on table and row gateway modules and re-evaluate whether we need an additional layer on top of that which would be Zend_Db_DataObject.

  13. #13
    SitePoint Zealot
    Join Date
    Oct 2004
    Location
    Worcester
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  14. #14
    Where's my title at? dreaz's Avatar
    Join Date
    Apr 2004
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by akrabat
    Even after those updates the demos are completely bugged

  15. #15
    SitePoint Wizard dreamscape's Avatar
    Join Date
    Aug 2005
    Posts
    1,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    uh, why did they steal Apple's RSS icon? It's not even that they used Apple's icon as influence for theirs... they blatantly stole it (it matches pixel for pixel). It's not as if freely available to use RSS icons are difficult to come across or it's difficult to make you own.

    Ok *maybe* that has nothing to do with the framework, but it gives a really bad impression when companies do things like that. I really lost quite a bit of respect for Zend what I saw that.

    How is digital theft "in the true PHP spirit"?


    On this framework, I'm not quite sure I see how it is any easier to use than existing, more developed PHP frameworks. Though it's only version 0.1.1, so I'll probably hold off too much experimentation and opinion formulation until its a bit more mature (at least version 1.0).

  16. #16
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    > I'm not quite sure I see how it is any easier to use than existing, more developed PHP frameworks.

    At the moment nope, I agree with you, but that isn't the issue, is it? What other PHP framework has the Zend name attached to it?

    From a business point of view, considering that how far Zend has come, and importantly, where they're going, the framework in time will not so much carry it's self, but the brand will; That is how I look at it anyways.

    Something else to do forget is the kind of influence that Zend can put across to get the right kind of people to develop and continue to develop the framework, when push comes to shove

    There is power in influence as the saying goes. Individuals, businesses, even goverments have fallen simply because of influence.

  17. #17
    SitePoint Addict
    Join Date
    Mar 2004
    Location
    Grand Junction, CO
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    From a business point of view, considering that how far Zend has come, and importantly, where they're going, the framework in time will not so much carry it's self, but the brand will; That is how I look at it anyways.
    That's a very interesting, and I think valid point. I for one would be wary of basing my business on the framework's name rather than its quality.

  18. #18
    SitePoint Addict
    Join Date
    Apr 2002
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pretty good,
    if anything it will attract developers from java and .net to php.

    Will I use it? if I get bored one day yes, but I already have some of these classes done myself so I don't really feel like setting up the whole thing especially on a host.

  19. #19
    SitePoint Guru Nick Carlson's Avatar
    Join Date
    Aug 2003
    Location
    Denver
    Posts
    644
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, it's amazing how such a large organization can produce such a large POS.

    If you are looking for a PHP framework, look no further: CakePHP - FAQ
    ncarlson.net - a programmer's dystopia

  20. #20
    SitePoint Guru thr's Avatar
    Join Date
    Jun 2003
    Location
    Sweden
    Posts
    664
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by optimus prime
    Wow, it's amazing how such a large organization can produce such a large POS.
    First of all, this is a preview release (while I do think that some parts are not that good, there are some gems in there). Second of all, the PHP Collaboration Project (which ZF is a part of as far as I can see...) is suported by IBM, Oracle and some others... CakePHP is supported by.. eh... hmm..*looks at black void*

  21. #21
    SitePoint Enthusiast
    Join Date
    Mar 2004
    Location
    Shorewood, IL
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by thr
    ...CakePHP is supported by.. eh... hmm..*looks at black void*
    Thr,
    Without knowing who or what is backing CakePHP you are a little out of place with this comment.

    Quote Originally Posted by Dr Livingston
    ...but I would wager a bet that for the long haul, Zends framework has more potential that Cake PHP has.
    Dr Livingston,
    While I do not agree with using the POS comment above, I will take that wager with you, contact me and we will make one.

    I can guarantee you that CakePHP will be around much longer then some here think. Our community grows daily as can be seen on the google groups site which as of this post is sitting around 1020 (http://groups.google.com/group/cake-php/about)

    We will have our first stable release within the next week if we do not have anymore bug reports, then our roadmap takes us to 1.0.
    And it is obvious people are downloading the framework (http://cakeforge.org/frs/?group_id=23&release_id=65)

    Also many large corporations are adopting CakePHP as their PHP framework of choice. So you can attempt to push us aside all you want, but we will continue to support the community that has been supporting us.

    No big hype with our project, we let it speak for itself.
    /**
    * @author Larry E. Masters aka PhpNut
    * @url CakePHP Rapid Development Framework
    */

  22. #22
    SitePoint Guru thr's Avatar
    Join Date
    Jun 2003
    Location
    Sweden
    Posts
    664
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 1PhpNut
    Thr,
    Without knowing who or what is backing CakePHP you are a little out of place with this comment.
    Well I've been reading some on your site, etc. and I couldn't find any link to any major company suporting you - care to point me in the right direction if I've missed something, but I doubt you got partners that can match IBM and Oracle.

    Quote Originally Posted by 1PhpNut
    Also many large corporations are adopting CakePHP as their PHP framework of choice. So you can attempt to push us aside all you want, but we will continue to support the community that has been supporting us.
    Name one then?

  23. #23
    SitePoint Zealot
    Join Date
    Oct 2004
    Location
    Worcester
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by optimus prime
    Wow, it's amazing how such a large organization can produce such a large POS.
    I'm sure that they would appreciate more constructive criticism. Certainly, they are actively responding to comments on the mailing list and the phrase "fixed in SVN" is turning up frequently.

    So far, I'm quite impressed with the way the mailing list is developing as it is looking like a community might develop nicely.

    The decision to start with Table and Row Gateways is interesting as it leaves it open for putting in a more "complex" orm should you need it.

  24. #24
    SitePoint Guru thr's Avatar
    Join Date
    Jun 2003
    Location
    Sweden
    Posts
    664
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by akrabat
    So far, I'm quite impressed with the way the mailing list is developing as it is looking like a community might develop nicely.
    Yes, the mailinglist sure is active (and good)

    Quote Originally Posted by akrabat
    The decision to start with Table and Row Gateways is interesting as it leaves it open for putting in a more "complex" orm should you need it.
    I agree on this, but I have to say that it feels quite strange to ship a framework with "just" Table/Row Gateways.

  25. #25
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow...

    That's very constructive of you to make that comment, not

    I certainly can't comment on ZF as it's too early but I would wager a bet that for the long haul, Zends framework has more potential that Cake PHP has.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •