Giter VIP home page Giter VIP logo

meetup's Introduction

Meetup API

This a very simple, one-file, PHP client for accessing most of the Meetup API.

Quick Start

  • Get your API key.
  • Require the library, create a Meetup object and set your key:
require 'meetup.php';
$meetup = new Meetup(array(
	'key' => 'YOUR_API_KEY'
));
  • Retrieve some events:
$response = $meetup->getEvents(array(
	'group_urlname' => 'YOUR-MEETUP-GROUP'
));

// total number of items matching the get request
$total_count = $response->meta_total_count;

$events = $response->results;

foreach ($events as $event) {
	echo $event->name . ' at ' . date('Y-m-d H:i', $event->time / 1000) . PHP_EOL;
}

Many of the get requests will match more entries than the API will return in one request. A convenience method has been provided to return the next page of entries after you have performed a successful get request:

$response = $meetup->getNext($response);

$events = $response->results; ...

Constructing the client

The class constructors takes one optional argument. This (array) will be stored in the object and used as default parameters for any request you make.

I would suggest passing the key when you construct the client, but you could do just $meetup = new Meetup; and then pass the key parameter in every request you make.

Doing GET requests

You can call any Meetup API GET-method using get().

Arguments

The method takes two arguments, of which the second one is optional:

  1. (string) Meetup API method (e.g. /2/events)
  2. (array) Meetup API method paramaters (e.g. array('group_urlname' => 'your-meetup-group'))

Path parameters

If the Meetup API method you need requires paramaters in it's path (like /:urlname/boards) you can pass the API method with the parameters already in their place (e.g. /your-meetup-group/boards) or provide the parameters in the second argument. (e.g. array('urlname' => 'your-meetup-group')). I would suggest using the latter method.

Response

If an error occures, the client will throw an Exception giving usefull information about what exactly went wrong.

If all is OK, it will return the JSON decoded response. This will be an (object) for version 2 methods and an (array) as far as I know.

Available short-hands

I've added just a few short-hand methods. If you check out the code you'll see they're all one-liners that simply call the general get() method and the version 2 ones filter out the results variable you need from the API response.

Feel free to fork the code and add more!

Client method API method
getEvents /2/events
getMembers /2/members
getPhotos /2/photos
getDiscussionBoards /:urlname/boards
getDiscussions /:urlname/boards/:bid/discussions

Roadmap

  • Implement POST and DELETE methods.
  • Add more short-hands.
  • Have some meetups...

Alternatives

Before starting this client, I checked out the following existing clients:

License

Copyright 2013 Fokke Zandbergen

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

meetup's People

Contributors

fokkezb avatar leftytennis avatar

Stargazers

João Piedade avatar otienoh avatar QsteveG avatar Joe Palala avatar Igor Lubinets avatar Anthony Delgado avatar Tom Eberhardt-Smith avatar Nicolas Mena avatar Andrés Godínez avatar Shaun Wakashige avatar Angel S. Moreno avatar Tom Taylor avatar Brian Hanifin avatar Sovithia S. avatar Frederic D. avatar  avatar Susan Buck avatar Ronan Bernard avatar

Watchers

James Cloos avatar Sovithia S. avatar xentientLABS LLC avatar

meetup's Issues

Error running sample event code

Hello, I want to use your library to extra the list of events in my meetup group. I can get the JSON response in the API console, and your library returns it (I proved it by displaying the output of print_r($response)). However, I am getting an error when trying to use your example array iteration code.

I used to be a web developer, but I used ASP mostly, and am generally rusty when it comes to coding so it might be something simple I overlooked. Do you have any thoughts why the sample code doesn't work? My code is on github for you to see, and I included the print_r() output in a gist link below.

_Error_
Warning: Invalid argument supplied for foreach() in pbm-meetup-events/import.php on line 20

_print_r($response) output_
https://gist.github.com/brianhanifin/db8eece1b454b06341b6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.