Download the PHP package moyasar/moyasar-php without Composer

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

moyasar-php

PHP version

Moyasar PHP wrapper library

Documentation

See the PHP API docs

Requirements

Notes

Installation

You can install it via composer

$ composer require moyasar/moyasar

Usage

In a Standard Project

After installing the library using composer and including autoload.php, the API key need to be set in order to use the services.

Setup is complete, create an instance of the service you need and start using it.

Payment

Note: Moyasar does not allow creating payments using the API (with some exceptions), instead you can use the payment form. That is why, wrapper libraries does not support it.


To fetch a payment, just simply do the following:

An instance of Payment will be returned, that has the data in addition to being able to perform operations like update, refund, capture, void on that payment instance, which we will get back to later.


To list payments associated with your account, simply do the following:

The all method will return an instance of PaginationResult this contains meta data about our result, like currentPage, totalPages etc...

To get the payments from this object, we just read the result property of that object.


The all method accepts an instance of Search or an array, this allows us to filter results and move along pages. It is quite simple to use:

The following methods are supported:


Once we fetch the desired payment, we can either update the description, refund it, capture it, or void it.

Invoice

For invoices, fetching and listing them is the same as payments, instead we use InvoiceService.

Although, we can use the API to create a new invoice, by doing the following:


With an instance of Invoice, we can either update, or cancel a given instance.

Laravel

First thing we need to add moyasar/moyasar to our Laravel project, to do it we need:

$ composer require moyasar/moyasar

After that, moyasar services need to be configured, so let us publish the configuration file:

$ php artisan vendor:publish --provider="Moyasar\Providers\LaravelServiceProvider"

Now edit config/moyasar.php and add your API key, by default the API key is read from an environment variable called MOYASAR_API_KEY, thus .env can be used to add the key.

If everything goes to plan, you should be able to get PaymentService and InvoiceService from laravel service container by simply called app helper function

Or inside your controller, you can simply type-hint one of the services in the constructor:


Or if you want a quick way to use these services, you can use the Payment and Invoice facades:

For example:

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/moyasar-php. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The package is available as open source under the terms of the MIT License.


All versions of moyasar-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
guzzlehttp/guzzle Version ^6.3|^7.0
ext-json Version *
guzzlehttp/psr7 Version ^2.1.1
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 moyasar/moyasar-php contains the following files

Loading the files please wait ....