PHP code example of sonole / laravel-gov-gr

1. Go to this page and download the library: Download sonole/laravel-gov-gr 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/ */

    

sonole / laravel-gov-gr example snippets


use Gemi;

Gemi::validate($afm);
Gemi::getGemiNumbers($afm);
Gemi::getGemiNumber($afm);
Gemi::companyBoard($afm);
Gemi::basicInfo($afm);
Gemi::balanceSheets($afm);

use Amka;

Amka::confirmRelAmka($relAmka, parentAmka: $parentAmka);
Amka::amka2data($amka);
Amka::data2amka(surname: $surname, firstName: $firstName);

use Ergani;

Ergani::employeeRelation($afm);
Ergani::employmentRelationship($afm, $refdate);
Ergani::employmentHistoryByPeriod($afm, $refdateFrom, $refdateTo);

use TaxRegistry;

TaxRegistry::retrieveInfoByAFM($afm);
TaxRegistry::lookupByAfm($afm); // the public RgWsPublic2 lookup, separate credentials

use BankConfirm;

BankConfirm::confirmAccount($iban, $afm);

namespace App\Taxisnet;

use Sonole\GovGr\TaxisnetOAuth\Contracts\TaxisnetOAuthLoginResponder;
use Sonole\GovGr\TaxisnetOAuth\Support\TaxisnetOAuthIdentity;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;

class MyLoginResponder implements TaxisnetOAuthLoginResponder
{
    public function respond(TaxisnetOAuthIdentity $identity, Request $request): Response
    {
        if ($identity->isLegalEntity()) {
            return redirect()->route('login')->with(
                'status', 'Company logins are not supported here, please sign in with an individual account.'
            );
        }

        $user = \App\Models\User::where('afm', $identity->afm)->first();

        if (! $user) {
            return redirect()->route('login')->with(
                'status', "No account found for VAT {$identity->afm}. Contact an administrator to get one created."
            );
        }

        Auth::login($user);
        $request->session()->regenerate();

        return redirect()->intended(route('dashboard'));
    }
}

use Sonole\GovGr\TaxisnetOAuth\Contracts\TaxisnetOAuthLoginResponder;
use Sonole\GovGr\TaxisnetOAuth\Contracts\TaxisnetOAuthLogoutHandler;

public function register(): void
{
    $this->app->bind(TaxisnetOAuthLoginResponder::class, \App\Taxisnet\MyLoginResponder::class);
    $this->app->bind(TaxisnetOAuthLogoutHandler::class, \App\Taxisnet\MyLogoutHandler::class);
}
bash
php artisan govgr:audit-report --service=gemi --from=2026-08-01
bash
php artisan vendor:publish --tag=taxisnet-oauth-views