Hi
I am very good in C and C++. I have to write php extension in C++ using Zend API and load it through php.ini . I am new to zend API and writing php extensions in C++. I have written my first basic extension and called the function in it through php code.
Actual Problem
My extension will process the JSON object on the server , parse through it and has to produce another text file which can be used by another program running on the server.
Any help on how to design my code is appreciated as I am new to Zend API. Do I have to write classes or just the functions are enough?
I downloaded php_manual.chm but its Zend API part is empty. If anyone knows from where can I find the documentation of Zend.
Thanks
Owais
Writing PHP extensions in C++ using zend API
Moderator: General Moderators
Writing PHP extensions in C++ using zend API
Last edited by momukhtar on Fri Mar 07, 2008 12:37 am, edited 1 time in total.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Writing PHP extensions in C++ using zend API
I'm not experienced in C/++ and/or PHP extension writing, but to answer your question regarding "functions vs classes" I'd suggest going down the same route as SimpleXML. Make it class-based, but provide functions for basic wrappers.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Re: Writing PHP extensions in C++ using zend API
Unfortunately, the Zend API is pitifully documented. I recommend you google around for some of the tutorial-ish docs available, also, checking out Schlossnagle's book on PHP5.
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Re: Writing PHP extensions in C++ using zend API
Also remember PHP5 or its later revisions has JSON built in - leverage off existing functionality where possible
.
Documentation of the API is absolutely attrocious. Before touching anything I strongly suggest getting hold of Sara Goleman's book on writing PHP extensions. It takes a case by case approach and is well worth the cost if you intend writing C extensions for PHP. After a reading I had little trouble parsing input and linking to other C APIs when I was doing some lightweight notification work for a PHP testing app.
Documentation of the API is absolutely attrocious. Before touching anything I strongly suggest getting hold of Sara Goleman's book on writing PHP extensions. It takes a case by case approach and is well worth the cost if you intend writing C extensions for PHP. After a reading I had little trouble parsing input and linking to other C APIs when I was doing some lightweight notification work for a PHP testing app.