Download the PHP package kly/onesdk without Composer

On this page you can find all versions of the php package kly/onesdk. 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 onesdk

One.co.id PHP SDK

Scrutinizer Code Quality Build Status Code Intelligence Status

This SDK is created for easier intergration and API usage of ONE APP.

For publisher only

Prerequisite

Installation

If you are using composer you could get it with composer require kly/onesdk and you are all set. Load up the autoloader and Call the classes or factory you need.

Usage

To use this SDK, there are several basic steps that should be done :

  1. Create and load credentials (client_id and client_secret or separated one use access_token)
  2. Instance your content into \One\Model\Article object
  3. Attach any necessary details (Photos, Videos, Galleries, Or extra Pages)
  4. Instance \One\Publisher Object
  5. Send your Article object through submitArticle method on Publisher

These are some examples code to perform those steps :

Load credentials

Refer to loadTestEnv() method.

Instance publisher object

Publish

If you want to publish an article, there are several steps should be done :

  1. Instance article object

  2. Attach if article contains some attachments

    Article supports multiple kind of attachment such as: photo, page.

  3. Publish the article to ONE App REST API by submitting through instanced publisher object.

$this->publisher->submitArticle($article);

Fetch

You can fetch all the articles by calling listArticle() on publisher object.

$this->publisher->listArticle();

Steps to contribute :

  1. Fork the original repository to your github repository.

  2. Clone from your repository

  3. To keep up to date with original repository, run this command

  4. Create branch. Remember, the name of branch should express what you're doing.

  5. Don't forget to install composer dependencies

  6. Modify the .env.example file, to reflect correct credentials.

  7. Save the .env.example as .env

  8. When you are ready to propose changes to the original repository, it's time to create pull request. To create pull request, run the following commands :

  9. Go to your github account, on tab pull request, add your comment. Be detailed, use imperative, emoticon to make it clearer.

  10. Watch for feedbacks.

PHP CS Fixer

PHP CS Fixer is intended to fix coding standard. So, Remember! to always run PHP CS Fixer before you create pull request.

Testing

How to Run Tests

Open a command prompt or terminal, navigate to project directory and run command composer run test

> php ./phpunit --bootstrap ./test/bootstrap.php ./test/
PHPUnit 4.8.36 by Sebastian Bergmann and contributors.

..................

Time: 14 seconds, Memory: 10.00MB

OK (18 tests, 98 assertions)

To see what test is running you can use command composer run test:verbose

> php ./phpunit --bootstrap ./test/bootstrap.php ./test/
PHPUnit 4.8.36 by Sebastian Bergmann and contributors.

Starting test 'One\Test\Unit\PublisherTest::testSubmitArticleWithoutAttachment'.
.
Starting test 'One\Test\Unit\PublisherTest::testSubmitArticleWithPhotos'.
.
Starting test 'One\Test\Unit\PublisherTest::testSubmitArticleWithPage'.
.
Starting test 'One\Test\Unit\PublisherTest::testSubmitArticleWithGallery'.
.
Starting test 'One\Test\Unit\PublisherTest::testSubmitArticleWithVideo'.

Time: 12.34 seconds, Memory: 10.00MB

OK (18 tests, 98 assertions)

What to Remember When Writing a Test

  1. Make sure to create test case for every core function on the class.
  2. Always compare data you expected or created before you make a request with the actual data that you get from a response.
  3. Use the correct assertion. Avoid using assertEquals to compare arrays because sometimes you will get array (response from server) values sorted in different order from your expected array. In example:
    
    $array = [
    '0'=>'500',
    '1'=>'A'
    ];

$arrayFromResponse = [ '0'=>'A', '1'=>'500 ];

Rather than sorting `$arrayFromResponse` to make the order equal, we can use `assertTrue` combine with `array_diff`

assertTrue(empty(array_diff($array, $arrayFromResponse)));


All versions of onesdk with dependencies

PHP Build Version
Package Version
Requires guzzlehttp/guzzle Version ~6.2
psr/log Version ^1.0
psr/http-message Version ^1.0
symfony/polyfill-intl-normalizer Version ^1.8
php-ds/php-ds Version ^1.2
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 kly/onesdk contains the following files

Loading the files please wait ....