PHP code example of amir-hossein5 / laravel-ip-logger

1. Go to this page and download the library: Download amir-hossein5/laravel-ip-logger 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/ */

    

amir-hossein5 / laravel-ip-logger example snippets


use AmirHossein5\LaravelIpLogger\Facades\IpLogger;

IpLogger::getDetails();

use AmirHossein5\LaravelIpLogger\Facades\IpLogger;

IpLogger::prepare(function ($details) {
  return $details + ['test' => 'test'];
})->getDetails();

use AmirHossein5\LaravelIpLogger\Facades\IpLogger;

IpLogger::model(ModelName::class)
  ->updateOrCreate(
    fn ($details) => [
      'ip'        => $details['query']
    ],
    fn ($details) => [
      'continent' =>  $details['continent'],
      'country'   =>  $details['country'],
      ...
    ],
);

use \AmirHossein5\LaravelIpLogger\Facades\IpLogger;

IpLogger::detailsBe(function () {
  return [ ... ];
})->updateOrCreate(...);

use AmirHossein5\LaravelIpLogger\Facades\IpLogger;

IpLogger::getLastException();

use AmirHossein5\LaravelIpLogger\Facades\IpLogger;

IpLogger::catch(function ($exception) {
  // send mail ...
})...;

/**
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
  AmirHossein5\LaravelIpLogger\Events\Failed::class => [
    IpLoggerFailed::class,
  ]
];

bash
php artisan vendor:publish --tag ipLogger