Code Monkey home page Code Monkey logo

ci-soundcloud's Introduction

SoundCloud PHP API Wrapper Demo Application

Screenshot

Introduction

This is an demo application based on the SoundCloud PHP API wrapper. It's written using the CodeIgniter framework.

Getting started

In order to the get application up and running you'll need to match the criteria below.

  1. You're running PHP5 or higher
  2. You got Redis installed

Great! Lets get started.

1. Register your application

Head over to SoundCloud and register your new application. You'll need to save the client id, client secret and redirect uri.

2. Create config.php

Copy the config sample using the command below. The command below assume you're standing in the root directory of this repository.

$ cp application/config/config.php.sample application/config/config.php

Open up the config.php file. And edit the following settings below.

  • cache_path: temporary upload directory for the application. Must be writable by the server.
  • salt: unique salt used to secure the user cookies. WordPress offers an excellent salt generator.
  • client_id: your application client id.
  • client_secret: your application client.
  • redirect_uri: your application redirect_uri.
  • redis::host: optional redis host. Only needed if Redis isn't running on localhost.
  • redis::port: optional redis port. Only needed if Redis isn't running on 6379.

3. Create htaccess

Copt the htaccess sample and make sure to edit the RewriteBase if other than /.

$ cp .htaccess.sample .htaccess

4. Voilà!

Your application should now be up and running.

Files of interest

Below you'll find a list of files that might be of interest.

application/controllers/sessions.php

Sessions::connect()

Generates the authorize URL.

Sessions::callback()

Handles the callback when a user has successfully been authorized over at SoundCloud. The supplied OAuth code is traded for an access token. The necessary data are then stored using Redis.

Sessions::refresh()

An access token will only stay valid for one hour. This method handles the refresh of the access token.

Sessions::dicsconnect()

Ends the current user session.

application/controllers/tracks.php

Tracks::add()

Validates the supplied post data and uploads the track to SoundCloud.

application/controllers/users.php

Users::show()

Get info about the logged in user.

application/libraries/MY_Controller.php

MY_Controller::MY_Controller()

Redirects non logged in users to the connect page and makes sure to refresh the token when needed.

ci-soundcloud's People

Watchers

James Cloos avatar

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.