Download the PHP package jonathantorres/medium-sdk without Composer

On this page you can find all versions of the php package jonathantorres/medium-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package medium-sdk

Medium SDK for PHP

Tests Version

Open source SDK for integrating Medium's OAuth2 API into your PHP application. Please note that Medium's API is still on an early stage and this implementation is not final. Breaking changes will happen. This SDK is unofficial. Medium's API documentation can be found here.

Installation

Authentication

Initialize the SDK with your client credentials:

You can also use the connect method.

Browser-based authentication

Request the authentication url, this url will take the user to medium's authentication page. If successfull, it will return an authorization code.

Grab the authorization code from the url and use the authenticate method to be able to make requests to the API. Now you should be able to start making requests.

Generate a new access token

Access tokens are valid for 60 days. Once it expires, you can request a new access token using your refresh token. Refresh tokens do not expire. You can request a new access token using your refresh token.

If you need to retrieve your refresh token after authentication, you can use the getRefreshToken(); method.

Authenticating with a self-issued access token

Medium recommends to use browser-based authentication, but you can also make requests to the API using a self-issued access token generated from your Medium settings page. These types of tokens never expire. Once you have it you can authenticate using this access token.

You can also use the connect method.

Now you should be ready to start making requests to the API using your self issued access token.

Users

Get the authenticated user details.

This will return an object with the user's details:

Publications

List the specified user publications

This will return an array of objects that represent a publication that the specified user is related to in some way.

List the contributors for the specified publication

This will return an array of users that are allowed to publish under the specified publication.

Posts

Creating a post

This will create a post on the authenticated user's profile. Provide the id of the authenticated user and the post data. This will return an object with the created post's details.

Creating a post under a publication

This will create a post on the authenticated user's profile but also associate it with a publication. Provide the same data as creating a post. The response will also be the same with the exception of adding the publicationId field.

Images

Uploading an image.

Provide an image resource, the image name and the extension. This will return an object with the uploaded image's data.

Running the examples

After cloning your repo:

Add your API credentials on examples/credentials.php

Start the included php server on the examples folder:

Run tests

Tests are written with PHPUnit.

After cloning your repo:

Generate a self-issued access token from your Medium settings page. You need this to run the integration tests. Then, just run composer test on the project's root directory:

Laravel Service Provider

A Service Provider for the Laravel Framework is now available, you can grab it here!

Changelog

Please see CHANGELOG for more information.

Contributing

Please see CONTRIBUTING for more details.

License

Licensed under the MIT license. Please see License file for more information.


All versions of medium-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jonathantorres/medium-sdk contains the following files

Loading the files please wait ....