Zend Studio 9 include built in Zend Framework Library - php

I recently installed Zend Studio 9 and created a Zend Framework project. In the setup options it says that it includes the Zend Framework library and when a project is created, under all the project files in the php explorer it says it's being included.
While this is true, I notice that the 'library' folder is empty. When I try to run public/index.php in the browser, it doesn't display anything.
My question is how can you include the built in library so that my public/index.php file shows in the browser? I know you can download the zend library files and put them in the library folder, but that gives a ton of warnings, and I can't help but think there is an easier way when the library is supposedly built right in.

Adding ZF support to a project in Zend Studio makes the IDE aware of the classes and file structure of the library so you get code completion, method descriptions, and argument lists presented to you in the IDE but does not actually give you access to the library.
You will need to download the actual files when you want to run/deploy your project. You can put them in your library folder, but typically I put them in a more common location that I add to the PHP include path in php.ini. This is optional though. If you drop the Zend folder in your library folder, you technically wouldn't need to add ZF support to the project since the builder will become aware of all the ZF content by analyzing all of thy ose files.
On another note, try editing php.ini and setting display_errors to 1 so you don't get a blank page. There is an error but it is being hidden due to the display_errors setting.

Related

phpstorm configuration for laravel, phalcon or codeigniter?

How do I configure PHPStorm autocomplete to framework codeignitir 3 and others, for example to call methods or function with ctrl+space?
This shouldn't be necessary for frameworks like Laravel or CodeIgniter, since their code should already be included in your PhpStorm project (and thus accessible to the IDE to facilitate code navigation/auto-completion/etc.).
However, since Phalcon is a PHP extension, you'll need to download its plaintext source files and include them as an external library in your PhpStorm project. To do this, clone the https://github.com/phalcon/phalcon-devtools.git repository into a folder outside of your main project folder. Let's call that folder "phalcon-devtools". Then from within your IDE: Preferences > Languages & Frameworks > PHP > Include Path > Add new > Specify other and choose the proper subfolder corresponding to the version of Phalcon you're using. (For example, phalcon-devtools/ide/2.0.5).

Determining Zend Framework version without version.php file

The problem is that I can't find the version.php file on the server within the Zend folder. The developer left so all I got is the source code which are also encrypted. I tried to call echo Zend_Version::VERSION; but Zend said "version.php" is not there. So I am out of means.
So I need to know:
What is the Zend Framework number? ( 1.? or 2.?)
As encrypted as the source code now is from what I see on the server, is it possible for someone to keep developing it? (I know PHP but not Zend Framework.)
Appreciated.
I think you can identify ZF major version by looking at directory structure even files are obfuscated.
ZF 1.12 Directory Structure
ZF 1.12 module Structure
ZF 2.0 Directory Structure
For ZF2 < 2.5 you can go to vendor/zendframework/zendframework/library/Zend/Version/Version.php
For Zf2 >= 2.5 you can go to
vendor/zendframework/zend-version/src/Version.php
And then in this class Version.php you have a constant wich tells you what version do you have (complete form with minor)
For Zf1 I have no clue, since I'm not using it.
For ZF1, you can check via /library/Zend/Version.php

Why Zend Framework has to be configured through include_path

Why do I have to configure an include_path when installing Zend Framework instead of just manually including? I've never done this before and can't really see the point, also I've spent some time trying to figure this out with no luck hence why I ask.
Actually I add Zend framework to the include path to be able to use Zend tool.
If you want to create a project structure and add controllers or models or even scripts using Zend Tool you will have to have Zend framework added to your include path.
Another reason you may want to ship your project without the library itself so that the end user doesn't update the framework version himself and break your code.
Also if you are working on different project at a time you may want to keep only one version of the framework shared between different projects. This is handy when you need to update your version of the framework without going through all projects every time.
You don't have to set your php include_path to include the ZF library you could just copy the whole ZEND directory into your applications Library directory and continue on.
But a lot of us are working on more then one project or don't want to have the library in our application so we add it to the php include_path so php and our application can find it.
Now if you are refering to the windows or linux path, those are required to use the ZF cli components ZF.bat and ZF.sh
When modifying the Include Path you can use Zend Framework without knowing the Full-Path of it. You can simply use require('Zend/Loader/Autoloader.php') and PHP will search in every include path.
For more information have a look at: http://php.net/manual/en/ini.core.php#ini.include-path

eclipse PDT: How to enable content/code assist for personal PHP libraries

I am struggeling getting content/code assist to work for PHP libraries (other than Zend) in my Zend Framework project folder:
library
Doctrine
Zend (<-works with code assist...)
ZendX
Content assist remains blank when using this libraries...
Any suggestions?
Thanks, Udo
Content Assist is available for any compatible resources in the include path.
Right click your project folder. Then Include Path. Then Configure Include Path. A window will appear. Configure any needed resources.
Further Information in the Zend Studio Manual:
Adding Elements to a Project Include Path
Include Paths
Code Assist Concept
This may be helpful for some one, I am using eclipse kepler, and I did not find Include_path variable. If you have same probleme as me, right click on the project and select configure then add php support. This will add php include path to your properties option. Then chose php include path and in the libraries folder add zend library location.

Code completion for PHP extensions in Zend Studio?

After having installed the HTTP extension from PECL, I expected Zend Studio 6 to recognize the provided HTTP* classes and for code completion to be made available. This is not the case, however. How do I get Zend Studio to recognize classes provided by PHP extensions? Specifcally, I want to be able to use code competition on these classes.
I used the phpgenerator.php script from Michael Spector. It generates a php documentation folder with the loaded extensions on your pc. Afterwards the doc path can be added to the Eclipse (Zend Studio) include path. Code Completion works like a charm.
usage:
console: php phpgenerator.php $path_to_doc_output
http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.pdt/plugins/org.eclipse.php.core/Resources/language/?root=Tools_Project
This script can be used for generating PHP model for PDT.
It builds PHP functions according to the loaded extensions in running PHP,
using complementary information gathered from PHP.net documentation
*
#author Michael Spector
In Eclipse, with which Zend Studio shares code, so it might help, is the "PHP Include Path".
"PHP Include Path" is in the project explorer.
There you can add the directory where the extensions are. Then Eclipse will scan it and you will be able to code-complete.
I did the same with PhpUnit2.
I'm not familiar with Eclipse, but if it works in the same way as Netbeans handles PHP extensions, you'll need to add the relevant stub PHP files to the IDE's search path.
You can add functions to Studio by putting PHP files with stub function descriptions into special directory. Find this directory in filesystem in a following way: write something like gmdate(), select the name and press F3. You will be taken to one of the prototype files. Note the directory where this file resides (shown on the top and if you hover over the tab). Now you need to create stubs for functions you are missing just like the one you're looking at. You can put them into any file, generally, but I suggest putting them into separate file - like geoip.php - and put this file into that directory. You may also want to do right-click/Show In/PHP Explorer and browse other prototype files if you need examples of how to do it right.
Zend ship language support for all the extensions in Zend Studio.
The most efficient way of adding support for language entities provided by unsupported extensions is definitely creating stubs (You can add this support yourself). The description "stub" files for all supported PHP entities can be found in this directory:
/.metadata/.plugins/org.eclipse.php.core/language
(this is also the location where you should put your stub files).

Categories