Download the PHP package clarus-it/http-client without Composer

On this page you can find all versions of the php package clarus-it/http-client. 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 http-client

clarus-it/http-client

Library HTTP client dalam bahasa pemrograman PHP untuk keperluan mengakses API ke aplikasi-aplikasi buatan Clarus IT. Library ini berlaku sebagai reference implementation dan contoh bagi yang perlu membuat implementasi untuk bahasa pemrograman lain.

Instalasi

Untuk menginstall library ini, bisa menggunakan composer:

Client Library

Penggunaan

Berikut contoh penggunaan ClarusHttpClient:

ClarusHttpClient mengimplementasikan Symfony HttpClientInterface, jadi bisa digunakan dengan cara yang sama dengan Symfony HttpClient.

Algoritma

Algoritma operasional HTTP client ini adalah sebagai berikut.

Catatan: Bagian pengecekan apakah token kedaluarsa sebenarnya boleh saja tidak diimplementasikan. Konsekuensinya, library hanya dapat tahu token sudah kedaluarsa setelah melakukan request ke server.

Pembuatan Implementasi Dalam Bahasa Pemrograman Lain

Pada bahasa pemrograman lain seharusnya tidak sulit untuk mengimplementasikan HTTP client ini. Untuk contoh, bisa melihat pada file ClarusHttpClient.php dan mengadaptasikan ke bahasa pemrograman lain tersebut.

Untuk keperluan parsing JWT, bisa menggunakan library yang ada di bahasa pemrograman yang digunakan. Daftar library bisa dilihat di jwt.io. Yang diperlukan untuk kasus ini adalah library yang dapat melakukan exp check.

Pagination

Ada endpoint yang memuat banyak data. Dalam kasus tersebut, biasanya akan menggunakan sistem pagination. Satu halaman akan memberikan beberapa data, beserta informasi halaman berikutnya. Dengan informasi tersebut, kita bisa mengambil data selanjutnya sampai tidak ada data lagi.

Halaman berikut dapat diketahui melalui header Link dengan rel=next. Library ini memberikan PaginationIterator yang dapat digunakan oleh client untuk melakukan iterasi terhadap endpoint dengan sistem pagination.

Penggunaan

Berikut contoh penggunaan PaginationIterator:

Algoritma

Algoritma iterator pagination adalah sebagai berikut.

Pembuatan Implementasi Dalam Bahasa Pemrograman Lain

Untuk melakukan implementasi dalam bahasa pemrograman lain, diperlukan library untuk melakukan parsing header link. Berikut adalah beberapa library yang dapat digunakan untuk beberapa bahasa pemrograman populer:

Lisensi

MIT


All versions of http-client with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
lcobucci/jwt Version ^5.2
symfony/http-client Version ^6.4 || ^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 clarus-it/http-client contains the following files

Loading the files please wait ...