Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: unicodeveloper/laravel-codepen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.0.0
Choose a base ref
...
head repository: unicodeveloper/laravel-codepen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 7 commits
  • 3 files changed
  • 1 contributor

Commits on Nov 8, 2015

  1. Copy the full SHA
    0eb8096 View commit details

Commits on Nov 9, 2015

  1. Copy the full SHA
    a6b27f3 View commit details
  2. Copy the full SHA
    a517677 View commit details
  3. Copy the full SHA
    43bb851 View commit details
  4. Copy the full SHA
    97abcc4 View commit details
  5. Copy the full SHA
    0198511 View commit details
  6. Copy the full SHA
    29f4ecd View commit details
Showing with 52 additions and 16 deletions.
  1. +7 −2 CHANGELOG.md
  2. +29 −9 README.md
  3. +16 −5 src/CodepenManager.php
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,10 +2,11 @@

All Notable changes to `laravel-codepen` will be documented in this file

## NEXT - YYYY-MM-DD
## 2015-11-09

### Added
- Nothing
- user function
- Update ReadMe to accomodate how to use user function

### Deprecated
- Nothing
@@ -18,3 +19,7 @@ All Notable changes to `laravel-codepen` will be documented in this file

### Security
- Nothing

## 2015-11-08

- Initial Release
38 changes: 29 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@

[![Latest Stable Version](https://poser.pugx.org/unicodeveloper/laravel-codepen/v/stable.svg)](https://packagist.org/packages/unicodeveloper/laravel-codepen)
[![License](https://poser.pugx.org/unicodeveloper/laravel-codepen/license.svg)](LICENSE.md)
![](https://img.shields.io/badge/unicodeveloper-approved-brightgreen.svg)
[![Build Status](https://img.shields.io/travis/unicodeveloper/laravel-codepen.svg)](https://travis-ci.org/unicodeveloper/laravel-codepen)
[![Quality Score](https://img.shields.io/scrutinizer/g/unicodeveloper/laravel-codepen.svg?style=flat-square)](https://scrutinizer-ci.com/g/unicodeveloper/laravel-codepen)
[![Total Downloads](https://img.shields.io/packagist/dt/unicodeveloper/laravel-codepen.svg?style=flat-square)](https://packagist.org/packages/unicodeveloper/laravel-codepen)

> Laravel 5 Package to work with Codepen. Very easy to use. Offers the use of Facades and Dependency Injection
@@ -91,27 +91,47 @@ Codepen::getProfile($username);
+"links": array:3 [▶]
}

Codepen::user('chriscoyier')->location;
// returns Milwaukee, WI

Codepen::user('chriscoyier')->nicename;
// returns Chris Coyier

Codepen::user('chriscoyier')->username;
// returns chriscoyier

Codepen::user('chriscoyier')->avatar;
// returns //s3-us-west-2.amazonaws.com/s.cdpn.io/3/profile/profile-512_22.jpg

Codepen::user('chriscoyier')->bio;
// returns I'm kinda into this whole CodePen thing.

Codepen::user('chriscoyier')->followers;
// returns 6399

Codepen::user('chriscoyier')->following;
// returns 1165

Codepen::getLovedPosts($username);
// e.g sample $username is chriscoyier, returns an array of the most loved posts belonging to chriscoyier
// e.g sample $username is chriscoyier, returns an array of his most loved posts

Codepen::getPopularPosts($username);
// e.g sample $username is chriscoyier, returns an array of the most popular posts belonging to chriscoyier
// e.g sample $username is chriscoyier, returns an array of his most popular posts

Codepen::getPublishedPosts($username);
// e.g sample $username is chriscoyier, returns an array of the most published posts belonging to chriscoyier
// e.g sample $username is chriscoyier, returns an array of his most published posts

Codepen::getLovedPens($username);
// e.g sample $username is chriscoyier, returns an array of the most loved pens belonging to chriscoyier
// e.g sample $username is chriscoyier, returns an array of his most loved pens

Codepen::getPopularPens($username);
// e.g sample $username is chriscoyier, returns an array of the most popular pens belonging to chriscoyier
// e.g sample $username is chriscoyier, returns an array of his most popular pens

Codepen::getPublicPens($username);
// e.g sample $username is chriscoyier, returns an array of the public pens belonging to chriscoyier
// e.g sample $username is chriscoyier, returns an array of his public pens

Codepen::getForkedPens($username);
// e.g sample $username is chriscoyier, returns an array of the most forked pens belonging to chriscoyier

// e.g sample $username is chriscoyier, returns an array of his most forked pens
```

## Change log
21 changes: 16 additions & 5 deletions src/CodepenManager.php
Original file line number Diff line number Diff line change
@@ -2,21 +2,22 @@

namespace Unicodeveloper\Codepen;

use Illuminate\Support\Facades\Config;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Config;


class CodepenManager
{

/**
* [$client description]
* @var [type]
* Instance of GuzzleHttp
* @var object
*/
protected $client;

/**
* [$response description]
* @var [type]
* Data response
* @var object
*/
protected $response;

@@ -181,6 +182,16 @@ public function getForkedPens($username)
return $this->data();
}

/**
* Get a user's details and access each attribute like username, avatar, location, bio etc
* @param string $username
* @return object
*/
public function user($username)
{
return $this->getProfile($username);
}

/**
* Get the details of the required request
* @return object