PHP class for use with Google Analytics API - php

I want to find a PHP class or framework to get data from the Google Analytics API.
I've already used gapi, which is great but it has never been updated since 2009 and it lacks new features from the API such as segments.
Can you please share the classes you've used and their key features ?
Thank you

Edit: I did find an experimental implementation of segments in issue 28 for the repository.
You mentioned gapi already but it seems to be the standard as far as a PHP library for Google Analytics goes. You may find fresher classes on GitHub with your needed functionality.
I took a look around and it seems that your best option is to fork an existing class such as gapi and add the functionality to it which is not what you wanted to hear. I recommend taking a look around at the Google supported libraries for clues on how they implemented the features you want.
This is a good opportunity for you to contribute to an open-source project. Even though this code was last changed in 2009, it's fairly short and can be easily customized to do what you want as long as the corresponding API functionality is there.
Try using the Query Explorer to see what's available. It looks like it will help you build segment queries too.

Related

Creating a Codeigniter Library

bit of a theory question this one. I would like to write my own library for codeigniter. It's going to be from connecting to different british Accountancy packages via API's. If it were a single package I was writing it for then I could create the library easily, however, it will be multiple. I intend to load the library as follows:
$params = array('package' => 'quickbooks');
$this->load->library('accountancy', $params);
Through my research so far, each API does not offer the same functionality therefore my library will have to be able to disable/enable functions based on the selected package. Also, the api's are different so each function will have to work differently based on the selected package also.
Firstly, is a library the best course of action?
Does anyone have any tutorials they can point me to or anything else to help?
Not looking for someone else to write it for me, just looking to be pointed in the right direction.
Thanks
There are probably multiple solutions.
If what you need to accomplish can be conceived as an abstraction layer (which means that, regardless of which accounting package you're using, you use the same functions to get things done) then using the "Drivers" approach might work.
First, check out the CI documentation for Using CodeIgniter Drivers.
CI uses the driver pattern for the cache, database and session classes. Studying that source code may prove helpful. Cache.php might be the easiest to get your head around to start with.
Via Google I found one Codeigniter Drivers Tutorial and I'm pretty sure the Stack Overflow has some info too.
Here's another example of using CI drivers.
I confess that I didn't look at either tut very closely. So I'm not certain how helpful they will be.

How do I get started implementing the grooveshark api

I have a client who wants me to implement the Grooveshark API into his site to be used as a fully fledged music system. It will be able to play, pause and skip songs from playlists that the user creates and and tracks the user favourites. So the user will have the ability to search for a track, add to playlist, favourite, play and the reverse of all these actions.
My question is. How do I get started. So I have the API (well the public version http://www.apishark.com as I am waiting for the full version to be sent to me). I look at the API and I just see what appears to me to be short snippets of code.
Is there some kind of a default way to implement an API, what do I need to know, how do I go about this task?
Any help will be appreciated.
Here you can find a php class to ease your work. It's not free but it's extremely cheap, and if you are not able to sort our how to use a standard REST api, and you have to do this for a work, maybe it's worth the price.
Or you can try here for a free class, but I never tried it and you have to use git to download the last version. I believe it's still under development, though.
Or, here you find a free python script that maybe it's easy to convert in PHP. Same here for a perl module.

How to document a Symfony based REST API (similar to enunciate's documentation capabilities)

If I have a REST based service written in the Symfony [symfony-project.org] framework (i.e. PHP), is there any decent tools/frameworks out there that will parse my code and generate API documentation?
The Java based framework enunciate has documentation capabilities similar to what I need, you can view an example of this here: http://enunciate.codehaus.org/wannabecool/step1/index.html.
I understand the premise of REST based services are supposed to be self evident, however I was after something that would generate this documentation for me without the need to manually write up all my endpoints, supported formats, sample output etc.
Thanks
Not sure if you've seen Swagger before. They seem to have a PHP compatible version, though I can't really vouch for it personally. It does some automatic API documentation generation comparable to enunciate, though it does look like it requires some heavy manual documentation via PHP comments. That being said, I think the manual effort will be the same or less than making your own via wiki pages, and the output is much, much nicer.
Just as a factoid, it looks like Enunciate has indefinite plans to eventually support other platforms, but the relevant Jira ticket is currently Open waiting for a sponsor to take on the work.
From the ENUNCIATE-356 Jira ticket:
The first step to supporting other languages is to decouple the Enunciate model from the Java model. This work is being tracked and logged at ENUNCIATE-584. Unfortunately, it never made it out of the investigate phase because of how heavy it is. Unless a sponsor for the work is found, I don't anticipate taking that heavy load on anytime soon.
Edit:
Found a similar question where someone mentions a GitHub project dedicated to Swagger+Symfony2. This other question is the same, but no additional information.
To my knowledge there is no way to automate the documentation of media types.
If you are using a media type like XHTML then a web crawler like Google sitemap may produce some useful output to show the relations between your resources.

Portable Contacts for PHP?

I can see Google is implementing the Portable Contacts API for developers to fetch a user's contacts. That seems like exactly what I want to do and I especially like the fact that the protocol is open and through it I can support more than just Google.
What I'd like to know is whether there is a library for PHP that implements this protocol, as I don't feel like writing one from scratch / reinventing the wheel.
I wouldn't generally post such questions which could be answered by simply googling, but I've done my googling on the subject and can't seem to find any relevant info.
BTW, I don't use Zend, so please don't suggest that to me, unless it's the only way possible.
The Open Social PHP Client can access the Portable Contacts API

What "Attributes" can Serena Mariner's SOAP API touch in UpdateInvestment()?

I'm trying to write an interface between a home-grown project management system and Serena Mariner. (The bigwigs like to read Mariner, the worker bees like to write to the home grown system.)
How can I (programmatically?) figure out what Attribute Keys are available?
I'm actually writing the interface in PHP, but any advice would be much appreciated.
Mariner seems to have an API for working with the system. Otherwise, it might be better to ask at the Mariner Support Forum.
Update: I took a little bit more of a look at the API and it doesn't specify the attributes, which is what your question is about. I guess the support forum is the better bet then.

Categories