BlogPHP support for KDevelop 4 (and eventually Quanta+) Syndicate content

Tue, 03/03/2009 - 00:28

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:

  • PHP built-in functions, classes, constants, superglobals
  • user-defined functions, classes, constants, superglobals, variables, etc.
  • proper code completion for objects which respects access modifiers (private, public, protected) and differentiates between static/non-static members and methods
  • code completion for overridable and implementable functions inside classes
  • hints in the argument list of function- and method class
  • sane code completion after keywords such as “extends, implements, catch(), new, throw” and some more I think

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

First of all I apologize for Wed, 08/25/2010 - 14:35 — Juan Manuel Lallana (not verified)

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

Big thanks to you guys and Thu, 02/25/2010 - 04:20 — Kalileo Webdesign (not verified)

Big thanks to you guys and all kdevelop developers!

I did not get it to work Thu, 02/25/2010 - 04:06 — Kalileo Webdesign (not verified)

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.

And there is nothing about Wed, 02/03/2010 - 16:09 — Evengard (not verified)

No success even after Wed, 02/03/2010 - 20:37 — Evengard (not verified)

No success even after recompiling…

evengard@TriOp:~$ aptitude Wed, 02/03/2010 - 18:34 — Evengard (not verified)

  1. evengard@TriOp:~$ aptitude show kdevelop-php
  2. Пакет: kdevelop-php
  3. Новый: да
  4. Состояние: установлен
  5. Автоматически установлен: нет
  6. Версия: 1.0.0~beta2-1
  7. Приоритет: необязательный
  8. Раздел: devel
  9. Сопровождающий: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
  10. Размер в распакованном виде: 3 133k
  11. Зависимости: 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 (>=
  12. 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)
  13. Описание: PHP plugin for KDevelop
  14. 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.
  15.  
  16. This package contains the PHP language support plugin.
  17. Сайт: http://www.kdevelop.org/
  18.  
  19. evengard@TriOp:~$ aptitude show kdevelop
  20. Пакет: kdevelop
  21. Состояние: установлен
  22. Автоматически установлен: нет
  23. Версия: 4:3.9.97-1
  24. Приоритет: необязательный
  25. Раздел: kde
  26. Сопровождающий: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
  27. Размер в распакованном виде: 4 702k
  28. Зависимости: 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 (>=
  29. 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
  30. Рекомендуются: gdb (>= 6.8.50), valgrind
  31. Описание: integrated development environment for KDE
  32. 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.
  33.  
  34. The application wizard can generate fully functional projects for terminal programs and GUI programs using Qt, KDE or GNOME.
  35. Сайт: http://www.kdevelop.org/
So that’s it probably…

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

Ehrm, evengard@TriOp:~$ Wed, 02/03/2010 - 16:05 — Evengard (not verified)

Ehrm,

  1. evengard@TriOp:~$ kbuildsycoca4
  2. kbuildsycoca4 running...
  3. evengard@TriOp:~$ sudo aptitude search kdevelop
  4. [sudo] password for evengard:
  5. i kdevelop - integrated development environment for KDE
  6. i A kdevelop-data - data files for the KDevelop IDE
  7. p kdevelop-dev - development files for the KDevelop IDE
  8. pi kdevelop-doc - Documentation for the KDevelop IDE
  9. 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?

What version of KDevelop & Wed, 02/03/2010 - 16:55 — Milian Wolff

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…

How to enable the code Wed, 02/03/2010 - 12:25 — Evengard (not verified)

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…

then the plugin is probably Wed, 02/03/2010 - 15:14 — Milian Wolff

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)?

can someone provide to me Tue, 07/28/2009 - 23:05 — Alex Oleshkevich (not verified)

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

Try Thu, 07/30/2009 - 13:01 — Milian Wolff

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

Your error indicates that you did not install kdevplatform properly.

hm, i’ve downloaded Tue, 08/04/2009 - 19:17 — Alex Oleshkevich (not verified)

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..

Take a look here: Tue, 08/04/2009 - 22:58 — Milian Wolff

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!

Yes! Finally! Milian, you Thu, 03/26/2009 - 13:44 — Rian Orie (not verified)

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.

No, we won’t backport these Thu, 03/26/2009 - 17:53 — Milian Wolff

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!

Maybe it’s possible to Wed, 03/18/2009 - 19:01 — Anonymous (not verified)

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.

I’ve never used OpenSuse nor Thu, 03/19/2009 - 01:27 — Milian Wolff

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 ;-)

I am glad to see support of Tue, 03/03/2009 - 12:33 — Patrick Allaert (not verified)

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!

Yep, a good debugger would be Tue, 03/03/2009 - 12:46 — Milian Wolff

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.

The odd thing with PHP Tue, 03/03/2009 - 17:46 — Larry Garfield (not verified)

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. :-)

Yes they work very Tue, 03/03/2009 - 18:24 — Patrick Allaert (not verified)

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.

hi this is awesome!! are Thu, 03/05/2009 - 11:34 — dereine (not verified)

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

There are none that I know Fri, 03/06/2009 - 12:26 — Milian Wolff

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.

xdebug starts debugging when Tue, 03/03/2009 - 17:53 — Niko (not verified)

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.

I have three words to say to Tue, 03/03/2009 - 12:28 — Larry Garfield (not verified)

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.

I’ll write a follow-up with a Tue, 03/03/2009 - 12:51 — Milian Wolff

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 ;-)

Do you feel the open source Tue, 03/03/2009 - 17:50 — Larry Garfield (not verified)

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.

Congratulations. I used Tue, 03/03/2009 - 03:54 — Henrique Marks (not verified)

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.

See my comments above - other Tue, 03/03/2009 - 12:53 — Milian Wolff

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.

Does this mean that KDevelop Tue, 03/03/2009 - 03:04 — Richard James (not verified)

Does this mean that KDevelop will replace Quanta?

Also where would I find information about Python plugin development?

The next Quanta is going to Tue, 03/03/2009 - 03:10 — Ian Monroe (not verified)

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

Will this get included in a Tue, 03/03/2009 - 00:38 — CoolGoose (not verified)

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? );

I’m not sure if there should Tue, 03/03/2009 - 08:25 — Niko (not verified)

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.

In a later release for sure Tue, 03/03/2009 - 00:55 — Milian Wolff

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!

it’s a bit OT, but it would Tue, 03/03/2009 - 00:38 — jack (not verified)

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 :)

Just today Matt Rogers Tue, 03/03/2009 - 00:53 — Milian Wolff

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!

oh this is greeeat Wed, 03/04/2009 - 23:15 — great (not verified)

oh this is greeeat

that would be a dream :) i’ll Tue, 03/03/2009 - 00:58 — jack (not verified)

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) :(

Also if possible can Tue, 03/03/2009 - 08:27 — Niko (not verified)

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

Post new comment

  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <pre>.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options