Use symfony framework with Eclipse PDT - php

I am begining a project in PHP that needs a framework. I've looked in vain for how to install either Symfony or Zend plugin for Eclipse, my IDE.
Any useful links or indications, please ?

http://symfony.dubture.com/installation/
But the best support Symfony in PhpStorm, look at the gifs: http://plugins.jetbrains.com/plugin/7219?pr=phpStorm

I also use PHP Storm at work but I'm just too cheap to buy it for home, so I use Eclipse with the Symfony plug-in! You can download it from the Eclipse marketplace for free, though it is only for Symfony 2.0, Symfony 2.5 is recognized, there are just a few features missing. I found that it still can be useful for code hinting and many Symfony-related helpers still pop up. It beats no helpers or hinting but it does lack many intuitive and time-saving features found in PHP Storm.
Anyway, here's the link directly from the Eclipse plug-in page: http://marketplace.eclipse.org/content/symfony-plugin
If you have Eclipse open, you can even just drag and drop the "Install" icon directly onto Eclipse and it should install automatically. Best of luck to you, #sk001!

I've found a solution.
Either for Zend or Symfony, to use it in eclipse PDT, you need first to download it from the official web site (zend's latest download page, Symfony's download page). Then, add the library to eclipse (Window -> Preferences -> PHP -> PHP Libraries and then new, navigate to the downloaded directory). Finally, after creating the project, right-click on it, Include Path -> Configure Include Path -> Add Library -> Choose User Library then next and select the needed libraries.
For Yii framework, you need to install the Yiiclipse plugin for your eclipse PDT.
I hope it'll help somebody.

Related

using TFS for non-Microsoft Projects

I work for a shop that has standardized on TFS. We have one project that was developed by a subcontractor in php. You can't even load this thing in Visual Studio.
I managed to create a repo for the project, but I need to find out how to check the project in. Is there some other app (like tortoiseSVN) that I can use to check stuff in and out without Visual Studio? Or is there some way to get VS to load the project and check it in and out without creating a .sln, .csproj, or any other unwanted files?
Actually, it's totally possible to use Visual Studio to do this.
You can use the web interface to create a repo...
You can't edit the php in Visual Studio of course, but you can open the Source Control Explorer to check the project into the repo.
You need to remember to go in Visual Studio to check files out before you edit them, and then check them back in when you're done.
It's clunky, but not as clunky as buying a $200 per year setup we're only going to use a few days out of the year. We're a Microsoft shop after all.
I'm assuming you're using TFVC and not Git for version control.
If you don't have Visual Studio at all, you can install Team Explorer. If you already have Visual Studio installed, that's fine too.
The tool you're looking for is tf.exe -- it's the command line tool for interacting with TFVC.
You can also consider using a Git repo instead of TFVC for this -- although TFVC can be used for any type of source code, it has a reputation of being exclusively for Visual Studio-based projects. Git is likely to be more familiar to folks who have never worked with TFS or TFVC and have not spent much time using Visual Studio.
You can use PhpStorm, then install the TFS Integrartion plugin for it, then you can manage the php projects in PhpStorm same as manage projects in VS.
Just follow the steps mentioned in below screenshot to configure the PhpStorm:
More information you can refer to Using TFS Integration.

Create New PHP Project in Eclipse

I want to create a new PHP Project in Eclipse but I found no PHP Project Option after clicking File > New >.
What should I do to create a new PHP Project in Eclipse Juno?
You need to install the PHP Development Tools package for Eclipse. From the link given:
In Eclipse, click Help -> Install New Software and work with *: http://download.eclipse.org/tools/pdt/updates/3.5
Once you have installed the plugin, you should be able to create a PHP project.
Do you install PDT? See this: http://www.eclipse.org/pdt/
You probably are on Java Perspective, whre "new PHP project" item isn't contributed. Use File -> New -> Other (ctrl+n shortcut) and select php project from list.
Off course Eclipse PDT have to be installed.
At the time of this writing, June 2018, the URL to download the plugin is:
http://download.eclipse.org/tools/pdt/updates/5.3
This will become outdated over time so anyone reading this post in the future should just check...
https://www.eclipse.org/pdt/
...for the current version.

Eclipse PDT + Code completion not working at all

I wanted to start a new Zend project, and currently I'm facing some issues regarding Eclipse PDT... My problem is, that the code completion in Eclipse for PHP does not work at all.
I tried a lot of different tutorials etc, for example making a new project and import the files; making a new workspace and import projects there; almost every possible combination of buildpath settings and library imports; deleting several files in .metadata (you will find lots of tutorials like this if you google for it), but nothing worked.
[Edit] Also the PHPNature is set (thanks to tranisstor):
<natures>
<nature>org.eclipse.php.core.PHPNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
(It also does not work if there is only the PHPNature set, and no other in addition)
[/Edit]
The problem in detail: I made a new Zend project, and tried to start coding in the IndexController.indexAction(). First thing I did: I typed in $this->, but no code completion came... I thought maybe I would need to add the Zend library, which I did. When I click into the Zend_Controller_Action in class IndexController extends Zend_Controller_Action I can see the documentation of Zend_Controller_Action, I also can press F3 and the corrosponding file will appear... Which means, Zend is successfully added as library.
I also tried Ctrl + Space, but just nothing happens. By the way, the standard PHP functions like isset() also won't show up in code completion
Does anybody have a idea how to fix this? I am using Eclipse Juno, with Eclipse PDT 3, and Zend Framework 1.x (don't know exactly, but it's not ZF2 and it works well if I open http://localhost.
I'm grateful for any help
I had the same problem when upgrading eclipse to Kepler. The following worked for me:
Remove files under workspace/.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2
The reason was that the workspace old DLTK index is not compliant with the new version and needs to be rebuilt. Start eclipse and the DLTK index will be regenerated.
Code completion worked for me again after that.
i feel you, i had to deal with this quite often too, and the mentioned .project file modifications didn't do the trick.
What helped me was this:
edit the .buildpath file and add
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
My complete build file might then look sth. like this:
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry kind="src" path=""/>
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
</buildpath>
i also added my folder which contains the php files to the build and include path (RMB over the project), but i don't think that it was necessary, the most important part was the modification of the .buildpath file for me.
Hope that helps...
The standard solution (at Eclipse forum) didn't work for me. What fixed this problem was the following:
going to Properties for my project (right click on it in PHP Explorer, then Properties),
select PHP Build Path/"Add Folder"
in there I ticked/selected my project's main folder.
It took a while while the DLTK database was refreshed (it could block your machine for a couple of minutes, be patient) but then it started working great.
Remove workspace/.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2/*. It should works.
Hope it helps!
I think this is the best way:
Right click on you project in the project Explorer » Configure » Add PHP support...
Maybe you need to edit your .project-File and add a "PHP nature" tag. See this thread for more information. I once had this issue after putting a project under svn version control and it seems to be a common problem.
I've found a sollution on eclipse forum. Downgrading to PDT 3.1.2 solved the problem.
Regards,
Marek
I had a similar issue, but involving just one PHP file. Then I found that I was using the following syntax for the initialization of a variable inside a method:
$rule = ($fullValidation)?(new StartTimeRule()):(new NullRule());
The problem seems to be the use of the inline condition. The code was working but apparently broke some Eclipse features, like the F3 command, autocompletion, the outline view, etc. I could be wrong, but I think this is a bug of the DTLK indexer.
I changed that line with a standard if statement, not an inline condition, and all the features now work again.
Hope this can help!
After trying the other possible solutions on this page, I managed to get code completion to work in PDT 3.2 with the latest Dynamic Languages Toolkit in Eclipse Juno.
Juno usually installs DLTK version 4.0 by default so I downloaded DLTK 5.0 from here: http://download.eclipse.org/technology/dltk/downloads/drops/R5.0/R-5.0-201306060709/. Use the Core Frameworks > EMF > Runtime Version link, which downloads a zip file so you will need to do a local install:
In Eclipse select Help > Install New Software > Add > Archive > navigate to the zip file > type DLTK in the Name box and confirm.
Use Eclipse's Install new software to get PDT 3.2 from the PDT repository, if it is not already installed: http://download.eclipse.org/tools/pdt/updates/3.2/release
Option 2: Before I tried the previous method I installed PDT 3.1, which I got from the Juno update site (instead of the PDT repository):
Install New Software > http://download.eclipse.org/releases/juno. Code completion worked in 3.1, so it's another possibility.
Download ZF2 and put it to your perefered Location (~Frameworks/ZF2)
Eclipse: Window > Preferences > PHP > Libraries = Push "New"-Button, add a Name
choose added Item and click "Add External Folder"-Button. Choose you ZF2 destination
Be sure, your Project is "PHP Project" (see: Mark Project-Base-Folder, click Project in Menu > Project Natures and choose PHP Project.
This will rebuild your Project, if not also choose Project > build Project.
Now all should work like a charm (on Kepler Service Release 2)

Netbeans and Zend Framework 2 configuration - zh.sh file

I am new to PHP and Zend Framework 2.
I am currently going through the ZF2 tutorial. I've run the commands:
php composer.phar self-update
php composer.phar install
Then opened up the latest Netbeans version. However, when asked for the zh.sh file, I couldn't find it anywhere in the zf2-tutorial folder. Is this file something that we need to create or is it expected to exist by default in the ZF2?
It'd be great if someone could point me to the right direction.
As other have hinted, NetBeans has not caught up to ZF2 yet (ZF has only been out for a handful of weeks).
As of right now, ZF2 has no command-line tooling (ie: zf.sh). Instead, you're encouraged to use the Skeleton Application to get things started.
While NetBeans doesn't have any specific ZF2 support, it's still a great IDE to use while developing ZF2 projects.
Just skip the ZF-specific stuff. Grab the Skeleton App, and create a new NetBeans project ("from existing sources"), and start hacking.
In all honesty, I can't remember ever using any of the ZF-specific stuff in netbeans. The framework is just a bunch of PHP files, and NetBeans works well without any framework-specific knowledge.
I don't know the content of zf.sh, but I was using this zf.bat in windows as it should be zf.sh in linux so's. This way I got from netbeans my zend core in the creation project phase ( with no errors):
git clone git://github.com/zendframework/ZendSkeletonApplication.git
cd ZendSkeletonApplication
php composer.phar self-update
php composer.phar install
With Zend included in php.ini, and COMPOSER_PROCESS_TIMEOUT=5000 set in the same file (also set max_execution_time=5000). This is because it didn't work for me to put it in command line orders.

Zend Framework Plugin for Eclipse PDT

I have eclipse PDT IDE version 1.2.0 installed. I have used it together with Dojo to develop very interesting Ajax applications. Now i want to enable the Zend framework within my eclipse IDE. How can i do this. After some googling, i have tried the following.
1.) downloaded the Zend framework and unzipped to my C directory.
2.) added the following path in my php.ini file
include_path = ".;C:\ZendFramework-1.10.5\library"
3.) changed the following line in the httpd.conf file in Apache to support .htaccess files
AllowOverride None to AllowOverride All
Restart Apache once and tested to see if this had any effect. I tested by trying to create a new PHP project and take a look at the structure of the project files.
The question is
1.) how can i include zend framework to an already existing eclipse pdt ide.
2.) is there a plugin that can be added directly or can i use the add software capabilities of eclipse. If yes, what URL do i have to supply for software download
3.) finally, how do i test to make sure that the zend framework has been properly installed
thanks for your help
I suggest setting ZF path as library for your ide (Preferences > PHP > PHP Libraries > New > Add External Folder). And then for your project: RMB on project in sidebar > Properties > PHP Include Path > Add Library > User Library > select your library.
I develop full time in Zend and this way is the best so far ;) (if you don't want to pay for ZendStudio ;)
1) You can add references to the Zend Framework to any project in Eclipse by configuring its include path.
2) I'd say that most of the custom Zend support built for Eclipse has gone into Zend Studio For Eclipse, from the folks at Zend. Of course, that costs money, but you're able to download and play with it for free. Of course, once you have ZF in your project's include path, it will show up in code completion and documentation snippets, etc.
3) Try using require_once on something in the Zend Framework folder. If you get an error, your PHP include path isn't properly set up.

Categories