Download the PHP package risan/jne without Composer

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

JNE HTTP Client

Build Status HHVM Status StyleCI Scrutinizer Code Quality Code Coverage SensioLabs Insight Latest Stable Version License

PHP HTTP client library for communicating with JNE website. This library can be used to retrieve JNE's delivery tariff and all available delivery locations.

Table of Contents

Dependencies

This package relies on the following libraries to work:

All above dependencies will be automatically downloaded if you are using Composer to install this package.

Installation

To install this library using Composer, simply run the following command inside your project directory:

Or you may also add risan\jne package into your composer.json file like so:

Then don't forget to run the following command to install this library:

Basic Usage

Here is some basic example about how to use this library:

Search for Origin

To search for available origin cities or locations, we can use searchOrigin() method that owned by the Jne\Jne class. We only need to pass the $query parameter which is a string.

This method will perform a HTTP request to jne.co.id website in order to search for all available origin locations that match the given $query.

On success this method will return an instance of Jne\Collections\LocationCollection class which contains a collection of Jne\Location instances. The LocationCollection itself is a subclass of Illuminate\Support\Collection, so we may leverage the rich features of Laravel's collection.

For example, we can find all available origin locations that matched the word bandar like so:

We can transform $origin into an array using toArray() method and see that it contains several Jne\Location instances:

Search for Destination

To search for all available destination cities or locations, we can use searchDestination() method. The usage is very identical with searchOrigin() method:

This method will also perform a HTTP request to jne.co.id website to search for all available destination locations that match the given $query.

This method will also return an instance of Jne\Collections\LocationCollection class.

For example, we'd like to search for destination locations that match purwodadi, we can do it like so:

If we printed out the $destinations results, we will get the following output:

Get Delivery Options

With this library we can also get all available delivery options offered by JNE, listing all the tariffs and estimatted delivery days.

Find or Create Origin Location

First we need to find or create an origin location of the package, it must be an instance of Jne\Location class. To find the origin location, we can use searchOrigin() method:

The $bandung variable will hold the following value:

If you already know the location's code, you may also create the Jne\Location instance manually. With this way we don't have to create an additional HTTP request to JNE website:

For example if we already know that BANDUNG has a location's code of QkRPMTAwMDA=, then we can create Jne\Location instance like so:

Find or Create Destination Location

The second step is to find or create a destination location of the package. To find the destination location:

Now the above $depok variable will hold the following value:

In case you already know the destination location's code, you can create an instance of Jne\Location manually:

For example if we already know that DEPOK as the destination has a location's code of RFBLMTAwMDA=, then we can create it like so:

Create Weight Instance

The third step is to create a Jne\Weight instance that reflects our package's weight. We have several ways to create a Jne\Weight instance:

For example if our package is 10 kilograms in weight, we need to create an instance on weight class like so:

Create Package Instance

The forth step is to create an instance of Jne\Package class. This instance represents our package that needs to be delivered.

Both the $origin and the $destination are instances of Jne\Location instance. While the $weight is an instance of Jne\Weight class.

Here is the complete example of how to create a package instance:

List All Available Options

And the last step to retrieve all available delivery options is to call the deliveryOptions() method and pass the Jne\Package instance:

This method will return an instance of Jne\Collections\DeliveryOptionCollection class which consist of a collection of Jne\DeliveryOption instances. Just like the LocationCollection class, this DeliveryOptionCollection class is also a subclass of Illuminate\Support\Collection.

For example we can fetch all available delivery options for 10 kilograms package from BANDUNG to DEPOK like so:

The $deliveryOptions will contain the collection of Jne\DeliveryOption instances. If we printed out the $deliveryOptions to the console, we'll get a list of various delivery options:


All versions of jne with dependencies

PHP Build Version
Package Version
Requires guzzlehttp/guzzle Version ^6.1
illuminate/support Version ^5.1
symfony/dom-crawler Version ^3.0
symfony/css-selector Version ^3.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 risan/jne contains the following files

Loading the files please wait ....