PHP - Zend Vs Custom - What Do You Think?
Hi all
I wonder if people can help me out here. It's a "bespoke" vs "framework" question, so not sure its belongs in here, but I didn't want to post it in the ZEND group, as it may have many more "pro ZEND fans" who read it, and I wanted a general thought. This is all based on the fact that I have a big project coming up and I want to know if I should be sticking with a custom job, or if something like ZEND is the way to go. Basically I have been developing PHP for about 2 years now and I have always thought a custom site written from scratch was the best way to go, not only does it allow you to have the minimal code needed to run the site, therefore reducing load, space and bandwidth, but it also allows you to know exactly how the system works, I guess the downside is that you have to spend more time doing the coding. But I have a few friends who use frameworks, ZEND has been coming up more and more, it's not really my ideal system to use as I prefer coding from scratch (not sure why), but they swear by it, and always tell me its great, its winning awards and none of them code from scratch, one of them even quoted that it "will become the standard for development" - is this true? Apart from being massively bulky and containing tons of files with scripts and functions that you might never ever use, what do people see as a downside to ZEND, If any? Is it best to code from scratch, and if so, why? Or does using something like ZEND much better? I guess if you always use ZEND, then you never really enhance your skill as a coder and never really learn anything new, plus I always think it's kind of cheeky using a pre-built system. Is there a good argument that would say using ZEND is not really a good idea? Or is the general feeling toward ZEND being a good thing? Surely if people know ZEND, they know how to play the security of the site to there advantage and therefore can break the security of other ZEND systems, or at least cause some hacks to a site. Any thoughts would be great Thanks everyone Similar TutorialsI'm sure it's not much, but I'm not understanding something with custom error handlers: I've created a custom error handler, which I initially set when my page loads : set_error_handler(array ( new ErrorHandler(), 'handleError' ));
It seems to catch all internal PHP errors, such as if I: var_dump($non_existing_var); right after the set_error_handler.... Now, I have an object that throws an exception after: set_error_handler(array ( new ErrorHandler(), 'handleError' )); $locale = new \CorbeauPerdu\i18n\Locale(...); // this should throw an exception ... I thought that with an error handler set, I could 'skip' the try/catch for it, but doing so, PHP spits out in its internal log: PHP Fatal error: Uncaught CorbeauPerdu\i18n\LocaleException: ....
My error handler doesn't catch it at all before, thus my page breaks!! If I want it to go through the error handler, I have to init my Locale with a try/catch and use trigger_error() like so: set_error_handler(array ( new ErrorHandler(), 'handleError' )); try { $locale = new \CorbeauPerdu\i18n\Locale(...); // this should throw an exception } catch(Exception $e) { trigger_error($e->getMessage(), E_USER_ERROR); } ... Is this normal ? I thought one of the goals of the error_handler was to catch anything that wasn't dealt with? Thanks for your answers! This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=354544.0 Here is my hierarchy: data -logs folder-debug.log htdocs -index.php include -Contollers,Smarty,Templater,Zend templates Now when I launch index.php from htdocs, I get this un-seeming error: "Fatal error: Uncaught exception 'Zend_Log_Exception' with message '"/var/htdocs/Books/practical_Web2.0/data/logs/debug.log" cannot be opened with mode "a"' in C:\xampp\php\PEAR\Zend\Log\Writer\Stream.php:69 Stack trace: #0 C:\xampp\htdocs\Books\practical_Web2.0\chapter-02\htdocs\index.php(11): Zend_Log_Writer_Stream->__construct('/var/htdocs/Boo...') #1 {main} thrown in C:\xampp\php\PEAR\Zend\Log\Writer\Stream.php on line 69 " I went to the zend folder in xampp, php, pear, zend, log, writer.php dir and I found this: /** * Class Constructor * * @param streamOrUrl Stream or URL to open as a stream * @param mode Mode, only applicable if a URL is given */ public function __construct($streamOrUrl, $mode = 'a') { if (is_resource($streamOrUrl)) { if (get_resource_type($streamOrUrl) != 'stream') { require_once 'Zend/Log/Exception.php'; throw new Zend_Log_Exception('Resource is not a stream'); } if ($mode != 'a') { require_once 'Zend/Log/Exception.php'; throw new Zend_Log_Exception('Mode cannot be changed on existing streams'); } $this->_stream = $streamOrUrl; } else { if (! $this->_stream = @fopen($streamOrUrl, $mode, false)) { require_once 'Zend/Log/Exception.php'; $msg = "\"$streamOrUrl\" cannot be opened with mode \"$mode\""; throw new Zend_Log_Exception($msg); } } $this->_formatter = new Zend_Log_Formatter_Simple(); } line 69 is =>throw new Zend_Log_Exception($msg); What could be wrong? Hint: settings.conf [development] database.type = pdo_mysql database.hostname = localhost database.username = root database.password = database.database = phpweb20 paths.base = /var/htdocs/Books/practical_Web2.0 paths.data = /var/htdocs/Books/practical_Web2.0/data paths.templates = /var/htdocs/Books/practical_Web2.0/templates logging.file = /var/htdocs/Books/practical_Web2.0/data/logs/debug.log Any pointer as to why there is a fatal error? I am a beginner in the ZEND framework. I am passing a variable through ajax query like this Code: [Select] $.ajax({ method: "GET", url: "/filename/fetch-client-data.php", dataType: 'json', // and so onI need to get the variable passed by the form. I dont know how to use the $_GET['varaible name'] from the form. Here is what I am trying in the controller function Code: [Select] public function fetchClientDataAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $this->get('variablename')=$variable_name; } Can someone point me in the correct direction I try to modify a twitter application, but I have no idea what I'm doing, this is my code so far: require 'Zend/Oauth/Consumer.php'; $token = unserialize($usersClass->twitterToken()); if(!empty($token)) { $client = $token->getHttpClient($config); $client->setUri('http://twitter.com/users/profile_image/twitter.json'); $client->setParameterGet('screen_name', $screen_name); $client->setMethod(Zend_Http_Client::GET); $response = $client->request(); } I want to get the twitter profile image, but I think it's too difficult for me... I currently have a file management system using Zend framework. Everything has been working great with .pdf files in the 2-4 MB range (both on upload and download).
There was a .pdf file that was about 7MB in size, which uploaded fine. When selecting the file to download, it completes in about 2 seconds and only downloads about 300KB. I checked on the server and the file actually did upload fine and was not corrupted BUT I cannot get beyond this file download issue.
All other files (in 2-4 MB range) seem to download fine.
Would it be a memory size issue? Would anyone know the issue or how I can correct?
Thanks so much in advance
Hey guys I've been reading the manual for zend framework 2...I under stand the layout helper...but a bit confused on where and when you would use the view to render and set variables? Would it be when you've disabled the layout helper and not wanting to include header, footer, side menus etc? Hope my question is clear and someone can explain when you would use the view instead of the layout helper This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=320893.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=330453.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=324009.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=345426.0 I have spent the last few days going over Zend framework 2, and I am finding it extremely complex. Not saying it shouldn't be, but it seems to solve problems I never have come across (so to speak) .
For instance:
Routing is super complex. I usually use torophp - which is simple & gets the job done.
Dependency injection - example of problem I have never come across.
My motivations for learning zend, are -
1. To write modular reuseable code.
2. Learn advanced / modern PHP , as far as frameworks are concerned I just know codeigniter.
3. A framework with good long term support.
Is there some other framework that is easier to learn ? and that would satisfy my requirements ?
I have been programming in PHP for the last 2-3 years btw, so I know my way around
Thanks
Edited by nik_jain, 31 August 2014 - 09:56 AM. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=328743.0 hello to all,
My issue is that i have a script encoded with zend and the script some pages work some are just BLANK
Zend it is installed :
This program makes use of the Zend Scripting Language Engine: Zend Engine v2.4.0, Copyright © 1998-2014 Zend Technologies with the ionCube PHP Loader v4.7.1, Copyright © 2002-2014, by ionCube Ltd., and with Zend Guard Loader v3.3, Copyright © 1998-2013, by Zend Technologies Configuration File (php.ini) Path /usr/local/lib Loaded Configuration File /usr/local/lib/php.ini and Its throwing exception he Can someone please help cuz i am tryin like a week to fix it but no results Edited by SSopranos, 07 January 2015 - 02:21 PM. I tried to find working tutorial for REST API and with these two frameworks but nothing what i found worked.Basicly i want to attach REST API
to a simple CRUD application.
So if anyone have links with good explanation that would be good.
This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=347443.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=353397.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=319964.0 I can't figure out how to optimize my Zend framework performance. My query executes in 200ms but my page is taking almost 60 seconds to load. While checking the zend toolbar it shows that my page size is 14mb and I don't know why. The routes and options size is really large but I don't know what is causing this. Any ideas?
To see the full breakdown:
http://awesomescreen....com/0c73vewycc
|