1. Go to this page and download the library: Download skrskr/paymob library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
# Events:
- Skrskr\Paymob\Events\TransactionSuccessedEvent::class
- Skrskr\Paymob\Events\TransactionFailedEvent::class
# Create two listeners for each event
# run two commands
php artisan make:listener PaymobTransactionSuccessedListener
php artisan make:listener PaymobTransactionFailedListener
namespace App\Listeners;
use Skrskr\Paymob\Events\TransactionSuccessedEvent;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class PaymobTransactionSuccessedListener
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param Skrskr\Paymob\Events\TransactionSuccessedEvent $event
* @return void
*/
public function handle(TransactionSuccessedEvent $event)
{
\Log::info($event->payload);
}
}
namespace App\Listeners;
use Skrskr\Paymob\Events\TransactionFailedEvent;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class PaymobTransactionFailedListener
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param Skrskr\Paymob\Events\TransactionFailedEvent $event
* @return void
*/
public function handle(TransactionFailedEvent $event)
{
\Log::info($event->payload);
}
}
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Skrskr\Paymob\Events\TransactionFailedEvent;
use Skrskr\Paymob\Events\TransactionSuccessedEvent;
use App\Listeners\PaymobTransactionSuccessedListener;
use App\Listeners\PaymobTransactionFailedListener;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
TransactionSuccessedEvent::class => [
PaymobTransactionSuccessedListener::class
],
TransactionFailedEvent::class => [
PaymobTransactionFailedListener::class
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
//
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.