MW

PHP support for KDevelop 4 (and eventually Quanta+)

Hello Planet KDE!

I want to give you a little insight on the current state of PHP support in KDevelop4:

Me and Nikolaus Sams (nsams) are working diligently on a plugin for PHP support in playground. It’s somewhat stable, i.e. we fix any crashes we stumble upon, but I would call it Alpha state at most. It may eat your babies so to speak. Yet I’m happy to say that at least one user is already using it for production (hi leinir ;-) ).

implemented PHP support

Well, here’s a (not complete) list of features that are already working. Though I have to warn you: no screenshots included ;-) It’s actually all very similar to the C++ screenies you can see on the web.

sematic highlighting

Let’s start with a feature that only very recently was added for PHP - semantic highlighting. Niko moved some language independent parts of the C++ plugin from KDevelop to KDevplatform and now PHP has the same code highlighting features as C++.

I personally love this feature since it makes it even easier to grasp code and it makes the code highlighting more consistent since there is no visual difference between PHP built-in functions/constants and your own.

code completion

Arguably one of the most useful features the DUChain enables us to write is code completion. There’s already full support for:

There’s still some bugs to fix and a few features to implement. But I can easily say that even the current state of code completion makes one wonder how he could use Quanta (from KDE3 times) for such a long time! It’s simply nothing compared to this!

The next feature I hope to add is support for type hinting in function calls. I.e. only show arrays where arrays are requested and the same for objects of a given type. Also no PHP keywords are currently completed at all

other DUChain/UseBuilder stuff

Thanks to the DUChain you already get lots of information about declarations, such as uses (which files, which lines etc.). Also very neat is the hover popup you might now from C++ which among others shows you phpdoc comments inside your browser. I also plan to integrate the php.net documentation into KDevelop, similar to what is already possible for QtHelp.

inline validation / syntax checking / linting

Another feature which saves lots of time is on-the-fly syntax checking: You won’t have to fire up your web-app inside a browser just to be greated by that pesty “syntax error, unexpected ‘CHAR’ in FILE on line XYZ” message… No! Instead you will see a nice reddish zig-zag line where you made the error and can fix it before heading off to the browser.

But we don’t only do basic syntax checking. We do more than that, thanks again to the power of the (holy?) DUChain. You can spot undeclared variables, function/method/class/constant redeclarations and more. Actually I hope that one day we spot most of the notices, warnings and errors PHP could emit.

tests

We already have a multitude of regression tests which will make sure that we don’t mess up any existing stuff. Lets hope for even more of them :) I love test-driven development.

The End

Well, thats pretty much it for the moment. You can have a look at what we are up to at the Quanta Feature plan on techbase.

If you are a PHP developer and can write C++ with Qt, why not get in touch with us? You can find us both on the KDevelop mailinglist and at least me and leinir are often found in #kdevelop on freenode.

PS:

Let me finish with a quick introduction of myself:

My name is Milian Wolff, I study Physics at the FU Berlin (just finished the 3rd semester). I started learning programming when I was around 14 with PHP. Over the years I became very good in it and the other webdevelopment techniques like Css, JavaScript etc. Recently I started to fullfill my biggest geek dream by learning C++/Qt/KDE and starting to contribute to the KDE project.

Some of you might now my from the LinuxTag in Berlin where I could be found at the Kubuntu-De.org community booth. At least with some of you I had a beer (well, I doubt it was only one ). I hope to repeat this tradition in 2009. Every once in a while I can also be spotted at ubuntu-berlin events.

Comments

Want to comment? Send me an email!

Comment by Juan Manuel Lallana (not verified) (2010-08-25 14:35:00)

First of all I apologize for my lack of spelling and grammar since I use the translator of goolgle. I’m going to work so much I did not read the comments but wanted to comment that I already am using in my production environment. When debugging with Xdebug not find how. Whenever I am difficult to move to eclipse, but I usually do not purge all the time.

Actually there are no words to thank the excellent work with respect to syntax, documentation, inspection, etc..

Thank you very much again, I leave my contact very happy and look forward to seeing the project as so much progress so far.

‘Juan Manuel Lallana juan.lallana@osperyh.org.ar’ Systems - Programming

Comment by Kalileo Webdesign (not verified) (2010-02-25 04:20:00)

Big thanks to you guys and all kdevelop developers!

Comment by Kalileo Webdesign (not verified) (2010-02-25 04:06:00)

I did not get it to work before, but now, together with KDE SC 4.4, I installed the latest beta of Kdevelop plus plugins as provided by OpenSuse, and now it works!!!

Code completion works now, it is one of the most useful features, indeed.

So that’s halfway there, and I hope that Quanta 4 comes rather [b]sooner[/b] than later.

Comment by Evengard (not verified) (2010-02-03 16:09:00)

And there is nothing about PHP here too: http://websvn.kde.org/trunk/playground/devtools/kdevelop4-extra-plugins/

Comment by Milian Wolff (2010-02-03 16:53:00)

this is outdated, we are now in extragear: http://websvn.kde.org/trunk/playground/devtools/kdevelop4-extra-plugins/

Comment by Evengard (not verified) (2010-02-03 20:37:00)

No success even after recompiling…

Comment by Evengard (not verified) (2010-02-03 18:34:00)
    evengard@TriOp:~$ aptitude show kdevelop-php
    Пакет: kdevelop-php
    Новый: да
    Состояние: установлен
    Автоматически установлен: нет
    Версия: 1.0.0~beta2-1
    Приоритет: необязательный
    Раздел: devel
    Сопровождающий: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
    Размер в распакованном виде: 3 133k
    Зависимости: kdebase-runtime (>= 4:4.3.0), kdelibs5 (>= 4:4.3.4), kdevplatform1-libs (>= 0.9.97), libc6 (>= 2.2.5), libgcc1 (>= 1:4.1.1), libqt4-dbus (>= 4:4.5.3), libqt4-designer (>= 4:4.5.3), libqt4-network (>= 4:4.5.3), libqt4-svg (>=
                            4:4.5.3), libqt4-xml (>= 4:4.5.3), libqtcore4 (>= 4:4.5.3), libqtgui4 (>= 4:4.5.3), libstdc++6 (>= 4.1.1), kdevelop (>= 4:3.9.97)
    Описание: PHP plugin for KDevelop
     KDevelop is an easy to use integrated development environment for KDE. It supports a wide range of programming languages and features project management, an advanced editor, a class browser and an integrated debugger.
     
     This package contains the PHP language support plugin.
    Сайт: http://www.kdevelop.org/
     
    evengard@TriOp:~$ aptitude show kdevelop
    Пакет: kdevelop
    Состояние: установлен
    Автоматически установлен: нет
    Версия: 4:3.9.97-1
    Приоритет: необязательный
    Раздел: kde
    Сопровождающий: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
    Размер в распакованном виде: 4 702k
    Зависимости: kdebase-runtime (>= 4:4.3.0), kdelibs5 (>= 4:4.3.4), kdevplatform1-libs (>= 0.9.97), libc6 (>= 2.2.5), libgcc1 (>= 1:4.1.1), libprocessui4 (>= 4:4.3.4), libqt4-dbus (>= 4:4.5.3), libqt4-help (>= 4:4.5.3), libqt4-network (>=
                            4:4.5.3), libqt4-script (>= 4:4.5.3), libqt4-webkit (>= 4:4.5.3), libqtcore4 (>= 4:4.5.3), libqtgui4 (>= 4:4.5.3), libstdc++6 (>= 4.4.0), libsublime1 (>= 0.9.97), kdevelop-data (>= 4:3.9.97-1), lcov
    Рекомендуются: gdb (>= 6.8.50), valgrind
    Описание: integrated development environment for KDE
     KDevelop is an easy to use integrated development environment for KDE. It supports a wide range of programming languages and features project management, an advanced editor, a class browser and an integrated debugger.
     
     The application wizard can generate fully functional projects for terminal programs and GUI programs using Qt, KDE or GNOME.
    Сайт: http://www.kdevelop.org/

So that’s it probably…

And do you mean http://websvn.kde.org/trunk/extragear/sdk/kdevelop-plugins/ ?

Comment by Evengard (not verified) (2010-02-03 16:05:00)

Ehrm,

    evengard@TriOp:~$ kbuildsycoca4
    kbuildsycoca4 running...
    evengard@TriOp:~$ sudo aptitude search kdevelop
    [sudo] password for evengard:
    i   kdevelop                                                                                                       - integrated development environment for KDE
    i A kdevelop-data                                                                                                  - data files for the KDevelop IDE
    p   kdevelop-dev                                                                                                   - development files for the KDevelop IDE
    pi  kdevelop-doc                                                                                                   - Documentation for the KDevelop IDE
    i   kdevelop-php                                                                                                   - PHP plugin for KDevelop

After KDevelop restart it changed nothing… In Help->loaded plugins nothing about PHP is mentioned… But I can create “New projects” with “PHP”… It wasn’t possible before I installed the kdevelop-php Where am I wrong?

Comment by Milian Wolff (2010-02-03 16:55:00)

What version of KDevelop & PHP plugin are proivded there? Is it KDevelop 3.9.97 (beta 7) and PHP beta 2?

Other than that: I’m lost, you should contact the package maintainer and ask him how he got it working…

Comment by Evengard (not verified) (2010-02-03 12:25:00)

How to enable the code validation for php? I downloaded and installed kdevelop with kdevelop-php from Debian experimental repository but the code validation doesn’t seem to work…

Comment by Milian Wolff (2010-02-03 15:14:00)

then the plugin is probably not getting loaded properly. Try running kbuildsycoca4 - does that change anything? Do you see the plugin in Help -> Loaded Plugins (called PHP Support)?

Comment by Alex Oleshkevich (not verified) (2009-07-28 23:05:00)

can someone provide to me compied php plugin for kdevelp and how-to install it, please? i could not compile it by myself. i just got the “CMake Error at app_templates/CMakeLists.txt:5 (kdevplatform_add_app_templates): Unknown CMake command “kdevplatform_add_app_templates”.” error and processs stops.

i want to try this!!

p\s: sorry, if wrong topic

Comment by Milian Wolff (2009-07-30 13:01:00)

Try this: http://milianw.de/blog/building-kdevplatform-kdevelop-and-the-php-plugin…

Your error indicates that you did not install kdevplatform properly.

Comment by Alex Oleshkevich (not verified) (2009-08-04 19:17:00)

hm, i’ve downloaded kdevplatform from svn, compiled and installed. but got nothing. also i tried to install it from ubuntu repo and got the same error..

Comment by Milian Wolff (2009-08-04 22:58:00)

Take a look here: http://milianw.de/blog/building-kdevplatform-kdevelop-and-the-php-plugin…

Esp. just kdevplatform won’t be enough. You’ll need kdevelop + php plugin as well!

Edit: whops, didn’t read the above comment thread. You’ll need to setup your environment properly, take a look at the article above. Esp. the paths which tell cmake where to look for modules are important!

Comment by Rian Orie (not verified) (2009-03-26 13:44:00)

Yes! Finally! Milian, you rock.

I haven’t yet made the move to KDE4 and am still running Kubuntu 8.04, any chance this could work on KDE3?? Regardless, I suppose this is just another incentive to finally make the move. Oh how happy I would be if there’s a native linux editor that actually works.

Comment by Milian Wolff (2009-03-26 17:53:00)

No, we won’t backport these features to KDevelop 3 if that’s what you whish for.

Yet you can run KDevelop4 from inside KDE3 just fine. You just need to get it somehow. For Kubuntu 8.04 I’d say you’ll have to compile kdelibs, kdeworkspace, kdevplatform, kdevelop and the php plugin. Maybe kdeworkspace is not even required.

Yet I can only say: try kde 4.2.x. I love it!

Comment by Anonymous (not verified) (2009-03-18 19:01:00)

Maybe it’s possible to publish a compiled kdevelop version with php support on opensuse buildserver? So a lot of users can test this feature.

Comment by Milian Wolff (2009-03-19 01:27:00)

I’ve never used OpenSuse nor their Build Server. And I’ve not that much spare time to get acquainted with it. If you are up to it, I’d love to get this running. Or try asking some OpenSuse wizards. I’ll stick to developing, hope you don’t mind ;-)

Comment by Patrick Allaert (not verified) (2009-03-03 12:33:00)

I am glad to see support of PHP development inside KDE4.

I see a very high opportunity for KDE/KDevelop here. There is currently no good cross platform development environment supporting REMOTE DEBUGGING with XDebug (which is using the DBGP debugging protocol).

Protoeditor implemented this feature as a kate/kwrite plugin and while supporting DBGP it was possible to debug Perl and Python at the same time! I would love seeing this again in KDE4 with KDevelop!

Cheers and keep up the good work!

Comment by Milian Wolff (2009-03-03 12:46:00)

Yep, a good debugger would be great. But I’ve never ever come across a good implementation in any IDE so far. Meaning: I’ve never used XDebug for actual debugging.

But that will change one day ;-) Let’s first get the basics working, than we’ll integrate XDebug for sure. I think that tons of people would say that’s a “must-have” for an IDE.

Comment by Larry Garfield (not verified) (2009-03-03 17:46:00)

The odd thing with PHP debugging is that in my experience XDebug and the Zend Debugger work in entirely different ways. XDebug (or at least any implementation of it I’ve used) forces the IDE and a dedicated browser window into always-debug mode, for however many page runs you have, until you disable it. With Zend (at least using Zend Studio 5.5, the only IDE I’ve gotten it working on), you get a Firefox or IE plugin toolbar where you can trigger “debug this page” or “debug the next request I make” as one-off executions. I’ve heard good arguments for both approaches, but personally I far prefer the Zend model. I don’t know if that’s a Zend vs. XDebug thing or a Zend Studio vs. other IDEs thing, though. (As I said, not a C-level person.) Again, happy to help test if I can figure out how. :-)

Comment by Patrick Allaert (not verified) (2009-03-03 18:24:00)

Yes they work very differently.

Zend Debugger is the result of Zend’s Vendor lock-in Business Model in many ways:

  1. XDebug implements an open protocol with specs availabe and is supported by many IDE, Zend Debugger implements a specific protocol that forces you to adopt the Eclipse PDT/Zend Studio.
  2. XDebug does not prevent other extension to load, Zend Debugger well.
  3. Zend Studio is based on Eclipse PDT, this last one has full support of XDebug, but they judged interesting disabling it in their commercial version, hopefully, you can enable it back.
  4. XDebug is Free and open source software :)

Concerning the “always-debug mode”, I am sorry to say it’s plain wrong. XDebug comes with a configuration (xdebug.profiler_enable_trigger) that let you debug one page or a whole session thanks to the GET/POST/COOKIE variable XDEBUG_SESSION_START.

A Firefox extension also exists to help you debugging from your browser.

Comment by dereine (not verified) (2009-03-05 11:34:00)

hi

this is awesome!!

are there any test debs for debian/ubuntu for kdevelop and your php completion availible, it would be nice to test this feature

Comment by Milian Wolff (2009-03-06 12:26:00)

There are none that I know of. You might want to check out my post on how to compile that stuff under Kubuntu though. It shouldn’t be hard to do.

Comment by Niko (not verified) (2009-03-03 17:53:00)

xdebug starts debugging when a special cookie is set. it would be pretty trivial to write a firefox extension that sets this cookie. (Don’t know how zend works tough)

but one thing said: as xdebug is oss I will prefer that one.

Comment by Larry Garfield (not verified) (2009-03-03 12:28:00)

I have three words to say to you: Bless your soul! :-)

I’ve been trying to find a non-crap PHP IDE forever. Zend Studio 5.5 is the only one I’ve found that I consider better than mediocre, but it’s discontinued and closed source and expensive. KDevelop would be ideal, as I’m a KDE user and a KDE-native IDE is going to be far far far faster than any of the Java-based options. The feature list you mention above sounds like it covers most of what I’m looking for that’s PHP-specific. (Things like good CVS/SVN integration are more language-agnostic.) The only thing it doesn’t mention is good real time debugger integration (using either XDebug or the Zend Debugger; XDebug is open source, but I’ve had much better luck getting the Zend Debugger to actually work nicely.)

Which leads me to the all important question… How can I help? My C/C++ knowledge is quite rusty, I don’t know Qt, and I can’t remember the last time I compiled something myself. But I know PHP quite well and routinely stress the language (I’m a Drupal developer; we do weird things at times), and I tend to be writing PHP nearly daily for both work and play. I’m currently running Kubuntu Intrepid with the KDE 4.2 packages.

So given that, what can someone like me do to help this project along? Any good tips on getting KDevelop4 with the PHP plugin running so that I can send in bug reports? Where do you want bug reports? Anything PHP-related you want to know about? Any non-C++ grunt work (XML config files or something) you need done? I’ve been hoping forever that someone would work on this, and I really want to try and help if I am able.

Comment by Milian Wolff (2009-03-03 12:51:00)

I’ll write a follow-up with a quick How-To on compiling kdevplatform + kdevelop + php plugin. Since I’m using Kubuntu with the KDE 4.2 packages as well, this should suit you well.

Regarding help: Testing would be great for starters. Then there’s some PHP scripts we use to generate a file containing PHP built-in constants, classes and functions with doccomments. I bet that the script could be cleaned up. Also there are still some bits missing, for example STDIN and STDOUT (defined for PHP in CLI mode). You could take a look at those (see createfunctions.php in SVN).

Regarding Debugger see my comment below.

PS: I just love the open source world :) I do KDE programming, you Drupal programming - and we two use both of them! Drupal rocks btw ;-)

Comment by Larry Garfield (not verified) (2009-03-03 17:50:00)

Do you feel the open source love? I feel the open source love. :-) (Curiously I find KDE and Drupal to have very similar architectural philosophies. That’s one reason I like both.)

I’m off to DrupalCon this week, but I’ll keep a look out for your follow-up post. I’ll see if I can rope in some other PHP devs to help as well, so if you can target “skilled PHP devs who don’t know C++” that’s probably the best target audience for testers.

Comment by Henrique Marks (not verified) (2009-03-03 03:54:00)

Congratulations. I used KDevelop4 in the first beta, and this is the first program that really impressed me in the KDE4 series. Of course, the others are reimplementations, so we already know the program. But KDevelop4 is an incredible and new program.

I have just one wish: why not try to make this an IDE for C development, or even better, a good IDE for embedded C developers ? We could open the IDE and set all the necessary configurations for embedded programming, and use this fantastic program. My wish is not so big: KDevelop4 is almost there. Support for custom Makefiles would be nice, for instance.

Thanks again for this great software.

Comment by Milian Wolff (2009-03-03 12:53:00)

See my comments above - other languages except C++ will follow in time. Currently the emphasize lies on creating a kick- ass C++/KDE/Qt development IDE. And that requires cmake.

But you are not the only one who requires/expects custom Makefile support. So eventually that will come for sure.

Comment by Richard James (not verified) (2009-03-03 03:04:00)

Does this mean that KDevelop will replace Quanta?

Also where would I find information about Python plugin development?

Comment by Ian Monroe (not verified) (2009-03-03 03:10:00)

The next Quanta is going to use kdevplatform. But its still going to be a separate program from KDevelop.

Comment by CoolGoose (not verified) (2009-03-03 00:38:00)

Will this get included in a beta2 or later release of kdevelop ? I can lend a hand with debugging this Also if possible can anyone tell me what’s the status of ftp/sftp support in kdevelop ? (does it know syncronizations, can it do auto pull/push on a ftp assigned to a project? );

Comment by Niko (not verified) (2009-03-03 08:25:00)

I’m not sure if there should ever be a kdevelop release with php support - instead we should release quanta with php support. On the other hand Quanta4 still has a long way to go - so a separate release of just php language support for kdevelop might be useful.

Niko

PS: nice you blog about our work - so people know progress is made.

Comment by Milian Wolff (2009-03-03 00:55:00)

In a later release for sure (eventually), but in beta2 I doubt. We still live in playground for starters. Also note that the KDevelop core developers plan to release KDevelop 4.0 with kick ass C++ as their top priority. Other languages will follow in later releases.

But maybe niko and I can still get the PHP plugin it into shape for 4.0. Let’s see!

Comment by jack (not verified) (2009-03-03 00:38:00)

it’s a bit OT, but it would be great to have also a ruby/ror support with kdevelop, now i’m using netbeans, but it’s too heavy :( but it seems that the ruby dev for kdevelop has died :( btw, great work with the php one, i’m kinda jealous that i don’t know php :)

Comment by Milian Wolff (2009-03-03 00:53:00)

Just today Matt Rogers (mattr) asked on the KDevelop ML for documentation on language plugins. He plans to revive the Ruby plugin, so stay tuned!

Comment by great (not verified) (2009-03-04 23:15:00)

oh this is greeeat

Comment by jack (not verified) (2009-03-03 00:58:00)

that would be a dream :) i’ll stay tuned, maybe i’ll try to help testing it, as i don’t know c++ (or just some very basic stuff) :(

Comment by Niko (not verified) (2009-03-03 08:27:00)

Also if possible can anyone tell me what’s the status of ftp/sftp support in kdevelop ? (does it know syncronizations, can it do auto pull/push on a ftp assigned to a project? );

You mean like the project upload in quanta3? I wrote a upload plugin for Quanta some time ago - haven’t checked if it still works for some time - but it should.

Niko

Published on March 03, 2009.