PHPackages                             dcard/sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. dcard/sdk

AbandonedArchivedSdk[API Development](/categories/api)

dcard/sdk
=========

It's unofficial Dcard sdk to access Dcard HTTP api

v1.1.2(9y ago)5292[1 issues](https://github.com/peter279k/dcard-sdk/issues)MITPHP

Since Aug 11Pushed 4y ago1 watchersCompare

[ Source](https://github.com/peter279k/dcard-sdk)[ Packagist](https://packagist.org/packages/dcard/sdk)[ RSS](/packages/dcard-sdk/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (14)Used By (0)

dcard-sdk
=========

[](#dcard-sdk)

Help you to access easily the internal and official HTTP Dcard api.

[![Latest Stable Version](https://camo.githubusercontent.com/864a5a1949b752269c444886b9a661ff3f7ef3c10db6c8ccfd3e11f6ca25596d/68747470733a2f2f706f7365722e707567782e6f72672f64636172642f73646b2f762f737461626c65)](https://packagist.org/packages/dcard/sdk)[![Total Downloads](https://camo.githubusercontent.com/d44b1fe314d1f0df45f91a891815d0f588fb01f8ccb48fbf4fc12b2c88dc9945/68747470733a2f2f706f7365722e707567782e6f72672f64636172642f73646b2f646f776e6c6f616473)](https://packagist.org/packages/dcard/sdk)[![Latest Unstable Version](https://camo.githubusercontent.com/0a92800dd85dc87955a35edbf56f6846a4efc75468bc1f8faa03f774ffca93fd/68747470733a2f2f706f7365722e707567782e6f72672f64636172642f73646b2f762f756e737461626c65)](https://packagist.org/packages/dcard/sdk)[![License](https://camo.githubusercontent.com/e32e768098c1bb2f70b7740b707856119bb41293d6bb2db2a5aa58c31907486f/68747470733a2f2f706f7365722e707567782e6f72672f64636172642f73646b2f6c6963656e7365)](https://packagist.org/packages/dcard/sdk)

Dcard HTTP API implementation
=============================

[](#dcard-http-api-implementation)

We implement the following API methods

The base url is

Request urldescriptionHTTP methodresponse formatthe method/\_api/meget account informationGETjsongetMe/\_api/forumsget forum listsGETjsongetForums/\_api/dcardget today "Dcard"GETjsongetDcard/\_api/notificationsget your notificationsGETjsongetNotification/\_api/posts/{post-id}get specified post contentsGETjsongetPostContents/\_api/forums/posts?popular={true/false}&amp;before={post-id}get specified forums's post listsGETjsongetPostLists/\_api/sessionsTo login the Dcard AccountPOSTjsondcardLogin/\_api/dcard/acceptInvite friendsPOSTjsonsendAccept/logoutlogout from the DcardGETjsondcardLogoutIf you have to call other api methods, please open issue and let me know your requirement

Usage
=====

[](#usage)

```
//dowloading the composer.phar firstly
curl -sS https://getcomposer.org/installer | php

//using composer.phar to install the dcard-sdk
php composer.phar require dcard/sdk
```

Sample code
===========

[](#sample-code)

```
require "vendor/autoload.php";

use Dcard\sdk\DcardSdk;

$dcard = new DcardSdk("your account", "your password");

//login

$response = $dcard -> dcardLogin();

//get me

$response = $dcard -> getMe();

//get forums

$response = $dcard -> getForums();

//get "dcard"

$response = $dcard -> getDcard();

//get your account notifications

$response = $dcard -> getNotification();

//get specified post

$response = $dcard -> getPostContents("your-post-id");

//invite friends

$response = $dcard -> sendAccept("your-first-message");

//get specified forum's post lists
/*
	@param(type: string) $ForumName: the forum English name.
	@param(type: string) $IsPopular: the post whether is popular in forum or not and the value is true or false.
	@param(type: boolean) $IsBefore: the post whether is the first page or specified page.
	@param(type: string) $PostId: the $IsBefore set true and the specified post id will get specified page.
	the $IsBefore set false and the specified post id will get specified page.
*/

$response = $dcard -> getPostLists($ForumName, $IsPopular, $IsBefore, $PostId);

//Dcard logout

$response = $dcard -> dcardLogout();
```

Unit Testing
============

[](#unit-testing)

I use PHPUnit to test the package.

Here is the steps to test the package.

Step 1
------

[](#step-1)

clone the project in master branch.

Step 2
------

[](#step-2)

manually download the PHPUnit.phar.

Step 3
------

[](#step-3)

download the composer.phar.

Step 4
------

[](#step-4)

do `php composer.phar install ` in project root folder.

Step 5
------

[](#step-5)

create the folder which name is report in project root folder.

Step 6
------

[](#step-6)

In DcardTest.php, replace the account and password on line 11 and 28.

Step 7
------

[](#step-7)

run testing: `php phpunit.phar src/dcard/sdk/DcardTest.php --coverage-html report/`

Here is the testing result.

[![Alt text](https://camo.githubusercontent.com/01a3d84fa8cf8fa8a46bcfe54ec8dad7a0c6423cb8ec8a9de03b2a3db0386bed/687474703a2f2f692e696d6775722e636f6d2f516d49773345772e706e67)](https://camo.githubusercontent.com/01a3d84fa8cf8fa8a46bcfe54ec8dad7a0c6423cb8ec8a9de03b2a3db0386bed/687474703a2f2f692e696d6775722e636f6d2f516d49773345772e706e67)

Change log
==========

[](#change-log)

2016/08/13
----------

[](#20160813)

1. add invite friend 新增寄送邀請功能

Related project
===============

[](#related-project)

Dcard-API is developed by Node.js: [Dcard-API](https://github.com/Larry850806/Dcard-API)

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

13

Last Release

3609d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/baa74b27c760b02871b04908382ae01967e7d7100c20144c71197cd680b99c98?d=identicon)[peter279k](/maintainers/peter279k)

---

Top Contributors

[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (27 commits)")

---

Tags

dcarddcard-sdkphp5php56

### Embed Badge

![Health badge](/badges/dcard-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/dcard-sdk/health.svg)](https://phpackages.com/packages/dcard-sdk)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[spatie/crawler

Crawl all internal links found on a website

2.8k17.7M58](/packages/spatie-crawler)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[spatie/laravel-export

Create a static site bundle from a Laravel app

672139.5k6](/packages/spatie-laravel-export)[sproutcms/cms

Enterprise content management and framework

242.2k4](/packages/sproutcms-cms)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
