Download the PHP package sabanovin/behfarda without Composer

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

Behfarda.com Laravel

Laravel package to connect to behfarda.com Payment Gateway

Installation

composer require sabanovin/behfarda

Publish Configurations

php artisan vendor:publish --provider="SabaNovin\Behfarda\BehfardaServiceProvider"

Config

Set your api key and redirect url in .env file:

BEHFARDA_MERCHANT_ID=test
BEHFARDA_CALLBACK_URL=/behafarda/callback

Usage

Payment Controller

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use SabaNovin\Behfarda\Exceptions\SendException;
use SabaNovin\Behfarda\Exceptions\VerifyException;
use SabaNovin\Behfarda\BehfardaPG;

class PaymentController extends Controller
{
    public function pay()
    {
        $behfarda = new BehfardaPG();
        $behfarda->amount = 100; // Required, Amount
        $behfarda->client_id = 'Client-ID'; // Optional
        $behfarda->description = 'Some Description'; // Optional
        $behfarda->mobile = '0912XXXXXXX'; // Optional, If you want to show user's saved card numbers in gateway
        $behfarda->valid_card_number = '6037990000000000'; // Optional, If you want to limit the payable card

        try {
            $behfarda->send();

            return redirect($behfarda->payment_url);
        } catch (SendException $e) {
            throw $e;
        }
    }

    public function verify(Request $request)
    {
        $behfarda = new BehfardaPG();
        $behfarda->token = $request->token; // behfarda.com returns this token to your redirect url

        try {
            $verify = $behfarda->verify(); // returns verify result from behfarda.com like (transId, cardNumber, ...)

            dd($verify);
        } catch (VerifyException $e) {
            throw $e;
        }
    }
}

Routes

Route::get('/behfarda/callback', 'PaymentController@verify');

Usage with facade

Config aliases in config/app.php :

'Behfarda' => SabaNovin\Behfarda\Facades\Behfarda::class

Send

Behfarda::send($amount, $redirect = null, $factorNumber = null, $mobile = null, $description = null);

SendArray

Alternatively, You can use sendArray method in facade to send optional data to Behfarda.com

Behfarda::sendArray([
  'merchant_id' => 'Merchant-ID', // optional, If you don't send this the package will read this from env
  'amount' => 100,
  'callback_url' => 'Your-Redirect-Url', // optional
  'client_id' => 'Client-ID', // optional
  'mobile' => 'Mobile-Number', // optional
  'description' => 'Your-Description', // optional
  'valid_card_number' => 'Valid-Card-Number' // optional
]);

Verify

Behfarda::verify($token);

Security

If you discover any security related issues, please create an issue or email me ([email protected])

License

This repo is open-sourced software licensed under the MIT license.


All versions of behfarda with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3 || ^8.0
ext-curl Version *
ext-json Version *
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 sabanovin/behfarda contains the following files

Loading the files please wait ....