Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /* __________________________________________________ | Obfuscated by YAK P..

Decoded Output download

<?php 
/*   __________________________________________________ 
    |  Obfuscated by YAK Pro - Php Obfuscator  2.0.14  | 
    |              on 2022-09-30 06:30:13              | 
    |    GitHub: https://github.com/pk-fr/yakpro-po    | 
    |__________________________________________________| 
*/ 
/* 
* Copyright (C) Incevio Systems, Inc - All Rights Reserved 
* Unauthorized copying of this file, via any medium is strictly prohibited 
* Proprietary and confidential 
* Written by Munna Khan <[email protected]>, September 2018 
*/ 
 
namespace App\Services; 
 
use App\Models\Package; 
use Illuminate\Support\Facades\DB; 
use Illuminate\Http\Request; 
use Illuminate\Support\Arr; 
use Illuminate\Support\Str; 
use Illuminate\Support\Facades\Log; 
use Illuminate\Support\Facades\Artisan; 
use Illuminate\Support\MessageBag; 
 
class PackageInstaller 
{ 
    public $package; 
    public $slug; 
    public $namespace; 
    public $path; 
    public $migrations; 
    public function __construct(Request $request, array $installable) 
    { 
        $this->package = array_merge($installable, $request->all()); 
        $this->slug = $installable["slug"]; 
        $this->namespace = "\Incevio\Package\" . Str::studly(Str::replace("-", "_", $this->slug)); 
        $this->path = $installable["path"]; 
        $this->migrations = str_replace(base_path(), '', $this->path . "/database/migrations"); 
    } 
    public function install() 
    { 
        Log::info("Installing package " . $this->slug); 
        try { 
            $package_data = array_merge($this->package, preparePackageInstallation($this->package)); 
            Package::create($package_data); 
            $this->migrate()->seed(); 
        } catch (\Exception $exception) { 
            Log::info("Package installation failed " . $this->slug); 
            Log::error(get_exception_message($exception)); 
            throw new \Exception("Package Installation Failed " . $this->slug); 
        } 
        Log::info("Successfully installed package " . $this->slug); 
        return true; 
    } 
    private function migrate() 
    { 
        Log::info("Migration started for " . $this->slug); 
        Artisan::call("migrate", ["--path" => $this->migrations, "--force" => true]); 
        Log::info(Artisan::output()); 
        return $this; 
    } 
    private function seed() 
    { 
        Log::info("Seeding package data for " . $this->slug); 
        foreach (glob($this->path . "/database/seeds/*.php") as $filename) { 
            $classes = get_declared_classes(); 
            include $filename; 
            $temp = array_diff(get_declared_classes(), $classes); 
            $migration = Arr::last($temp, function ($value, $key) { 
                return $value !== "Illuminate\Database\Seeder"; 
            }); 
            Artisan::call("db:seed", ["--class" => $migration, "--force" => true]); 
            Log::info(Artisan::output()); 
            dZ96c: 
        } 
        itUgj: 
        return $this; 
    } 
    public function uninstall() 
    { 
        Log::info("Uninstalling Package: " . $this->slug); 
        $file = $this->path . "/src/Uninstaller.php"; 
        if (!file_exists($file)) { 
            goto YgzjC; 
        } 
        include $file; 
        YgzjC: 
        $class = $this->namespace . "\Uninstaller"; 
        if (class_exists($class)) { 
            goto fUnMd; 
        } 
        Log::info("Uninstaller not found in the package dir for " . $this->slug); 
        throw new \Exception("Uninstaller not found for the package " . $this->slug); 
        fUnMd: 
        try { 
            (new $class())->cleanDatabase(); 
            $this->rollback(); 
        } catch (\Exception $e) { 
            Log::info("Package uninstallation failed: " . $this->slug); 
            throw new \Exception("Uninstallation failed: " . $this->slug); 
        } 
        Log::info("Successfully uninstalled package " . $this->slug); 
        return $this; 
    } 
    private function rollback() 
    { 
        Log::info("Roll back called..."); 
        $migrations = array_reverse(glob($this->path . "/database/migrations/*_*.php")); 
        if (!empty($migrations)) { 
            goto rreHt; 
        } 
        Log::info("No migration to roll back for package " . $this->slug); 
        return $this; 
        rreHt: 
        foreach ($migrations as $filename) { 
            $migration = str_replace(".php", '', basename($filename)); 
            Log::info("Rolling back: " . $migration); 
            $row = DB::table("migrations")->where("migration", $migration); 
            if ($row->first()) { 
                goto iDk1c; 
            } 
            Log::info($migration . " was not migrated before, probably it\'s a new migration file."); 
            Log::info("Skipping rolled back: " . $migration); 
            goto DN5MX; 
            iDk1c: 
            $class = Str::studly(implode("_", array_slice(explode("_", $migration), 4))); 
            if (class_exists($class)) { 
                goto Awvq8; 
            } 
            include $filename; 
            Awvq8: 
            (new $class())->down(); 
            if ($row->delete()) { 
                goto x7zi3; 
            } 
            Log::info("Rollback FAILED: " . $migration); 
            throw new \Exception("Migration rollback failed: " . $this->slug); 
            goto zRYBZ; 
            x7zi3: 
            Log::info("Rolled back: " . $migration); 
            zRYBZ: 
            DN5MX: 
        } 
        yLPtJ: 
        Log::info("All migrations has been rolled back for package " . $this->slug); 
        return $this; 
    } 
} 
 ?>

Did this file decode correctly?

Original Code

<?php
/*   __________________________________________________
    |  Obfuscated by YAK Pro - Php Obfuscator  2.0.14  |
    |              on 2022-09-30 06:30:13              |
    |    GitHub: https://github.com/pk-fr/yakpro-po    |
    |__________________________________________________|
*/
/*
* Copyright (C) Incevio Systems, Inc - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
* Written by Munna Khan <[email protected]>, September 2018
*/

namespace App\Services;

use App\Models\Package;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\MessageBag;

class PackageInstaller
{
    public $package;
    public $slug;
    public $namespace;
    public $path;
    public $migrations;
    public function __construct(Request $request, array $installable)
    {
        $this->package = array_merge($installable, $request->all());
        $this->slug = $installable["\163\x6c\165\x67"];
        $this->namespace = "\x5c\x49\156\143\145\166\151\x6f\134\x50\x61\x63\153\x61\x67\145\x5c" . Str::studly(Str::replace("\55", "\x5f", $this->slug));
        $this->path = $installable["\160\x61\164\x68"];
        $this->migrations = str_replace(base_path(), '', $this->path . "\x2f\144\141\x74\x61\142\x61\163\x65\x2f\155\151\147\x72\141\x74\151\x6f\x6e\163");
    }
    public function install()
    {
        Log::info("\x49\156\x73\164\141\154\x6c\x69\156\x67\x20\160\141\143\x6b\x61\x67\x65\40" . $this->slug);
        try {
            $package_data = array_merge($this->package, preparePackageInstallation($this->package));
            Package::create($package_data);
            $this->migrate()->seed();
        } catch (\Exception $exception) {
            Log::info("\x50\141\x63\153\x61\x67\145\40\x69\156\x73\x74\x61\154\154\141\164\x69\157\x6e\x20\146\141\151\x6c\x65\144\40" . $this->slug);
            Log::error(get_exception_message($exception));
            throw new \Exception("\x50\x61\x63\153\141\x67\145\x20\111\x6e\163\164\141\x6c\x6c\141\x74\x69\157\156\40\x46\x61\x69\x6c\x65\144\x20" . $this->slug);
        }
        Log::info("\x53\x75\143\x63\145\x73\x73\x66\x75\154\154\171\40\x69\156\x73\x74\141\154\154\x65\x64\40\x70\x61\143\x6b\x61\x67\145\x20" . $this->slug);
        return true;
    }
    private function migrate()
    {
        Log::info("\x4d\x69\147\x72\141\x74\x69\x6f\x6e\x20\x73\x74\141\162\x74\x65\144\x20\146\157\162\x20" . $this->slug);
        Artisan::call("\155\x69\147\162\141\164\x65", ["\x2d\55\x70\141\164\x68" => $this->migrations, "\x2d\55\x66\x6f\162\143\145" => true]);
        Log::info(Artisan::output());
        return $this;
    }
    private function seed()
    {
        Log::info("\123\x65\145\x64\151\156\147\40\160\x61\143\153\x61\147\x65\x20\144\141\164\141\x20\146\x6f\x72\x20" . $this->slug);
        foreach (glob($this->path . "\x2f\144\x61\164\141\142\141\x73\x65\x2f\x73\145\145\144\163\x2f\x2a\56\160\150\160") as $filename) {
            $classes = get_declared_classes();
            include $filename;
            $temp = array_diff(get_declared_classes(), $classes);
            $migration = Arr::last($temp, function ($value, $key) {
                return $value !== "\111\x6c\154\x75\155\151\x6e\x61\x74\x65\134\104\141\x74\x61\x62\141\163\145\134\x53\145\145\144\145\x72";
            });
            Artisan::call("\x64\x62\x3a\163\145\145\x64", ["\55\x2d\x63\x6c\141\163\x73" => $migration, "\x2d\55\146\157\162\143\145" => true]);
            Log::info(Artisan::output());
            dZ96c:
        }
        itUgj:
        return $this;
    }
    public function uninstall()
    {
        Log::info("\x55\156\151\x6e\x73\164\x61\154\154\x69\x6e\x67\x20\120\x61\x63\153\141\147\x65\x3a\40" . $this->slug);
        $file = $this->path . "\57\163\162\x63\57\x55\156\151\x6e\x73\164\x61\x6c\154\145\162\56\x70\150\x70";
        if (!file_exists($file)) {
            goto YgzjC;
        }
        include $file;
        YgzjC:
        $class = $this->namespace . "\134\125\156\x69\156\163\164\x61\x6c\154\x65\x72";
        if (class_exists($class)) {
            goto fUnMd;
        }
        Log::info("\x55\156\x69\156\x73\164\x61\x6c\x6c\145\162\40\x6e\157\164\40\146\x6f\165\156\144\40\x69\156\x20\164\x68\145\x20\160\141\143\153\141\x67\145\40\144\151\162\40\x66\157\x72\40" . $this->slug);
        throw new \Exception("\125\x6e\x69\x6e\x73\x74\x61\x6c\x6c\x65\162\40\156\x6f\164\40\146\157\165\156\x64\40\x66\x6f\162\40\164\150\145\40\160\141\x63\153\x61\147\145\x20" . $this->slug);
        fUnMd:
        try {
            (new $class())->cleanDatabase();
            $this->rollback();
        } catch (\Exception $e) {
            Log::info("\x50\141\x63\153\x61\x67\x65\40\165\156\151\x6e\x73\x74\141\154\x6c\x61\164\x69\157\156\40\146\141\151\x6c\x65\144\72\40" . $this->slug);
            throw new \Exception("\125\x6e\x69\156\163\x74\141\154\x6c\x61\x74\151\x6f\156\40\146\141\151\x6c\x65\x64\72\x20" . $this->slug);
        }
        Log::info("\x53\x75\143\x63\145\163\x73\x66\x75\x6c\154\x79\x20\x75\156\151\156\163\x74\x61\154\x6c\x65\x64\40\x70\141\x63\x6b\x61\147\145\x20" . $this->slug);
        return $this;
    }
    private function rollback()
    {
        Log::info("\x52\157\x6c\x6c\x20\x62\x61\143\153\40\x63\x61\x6c\154\145\144\x2e\56\56");
        $migrations = array_reverse(glob($this->path . "\x2f\x64\x61\164\141\142\x61\163\x65\57\x6d\151\x67\x72\x61\x74\151\157\156\163\57\52\137\52\x2e\x70\x68\x70"));
        if (!empty($migrations)) {
            goto rreHt;
        }
        Log::info("\116\x6f\40\155\x69\x67\162\x61\164\x69\x6f\156\40\x74\x6f\x20\x72\157\154\x6c\40\142\141\143\x6b\40\146\157\162\x20\160\141\143\153\141\147\x65\40" . $this->slug);
        return $this;
        rreHt:
        foreach ($migrations as $filename) {
            $migration = str_replace("\x2e\160\150\160", '', basename($filename));
            Log::info("\x52\157\154\x6c\151\156\x67\x20\x62\x61\x63\x6b\x3a\x20" . $migration);
            $row = DB::table("\x6d\x69\x67\x72\x61\x74\x69\x6f\156\x73")->where("\155\151\147\x72\x61\164\151\x6f\156", $migration);
            if ($row->first()) {
                goto iDk1c;
            }
            Log::info($migration . "\40\167\x61\163\40\x6e\x6f\164\x20\x6d\151\x67\162\141\164\x65\144\x20\142\x65\x66\157\162\145\x2c\40\x70\x72\157\142\141\142\x6c\171\x20\151\x74\134\47\x73\x20\x61\x20\x6e\145\x77\x20\x6d\151\147\x72\x61\164\x69\x6f\156\x20\x66\151\154\145\x2e");
            Log::info("\123\x6b\151\x70\x70\151\x6e\147\x20\x72\157\154\x6c\145\144\40\142\141\143\153\72\40" . $migration);
            goto DN5MX;
            iDk1c:
            $class = Str::studly(implode("\x5f", array_slice(explode("\137", $migration), 4)));
            if (class_exists($class)) {
                goto Awvq8;
            }
            include $filename;
            Awvq8:
            (new $class())->down();
            if ($row->delete()) {
                goto x7zi3;
            }
            Log::info("\122\x6f\x6c\154\142\x61\143\153\x20\x46\101\x49\114\105\x44\72\x20" . $migration);
            throw new \Exception("\x4d\x69\147\x72\141\x74\151\157\x6e\x20\x72\x6f\x6c\154\x62\141\143\153\40\x66\141\x69\x6c\145\144\72\x20" . $this->slug);
            goto zRYBZ;
            x7zi3:
            Log::info("\122\x6f\154\x6c\x65\144\x20\142\141\143\153\x3a\x20" . $migration);
            zRYBZ:
            DN5MX:
        }
        yLPtJ:
        Log::info("\101\154\x6c\40\x6d\151\x67\162\x61\164\x69\157\x6e\163\40\150\x61\x73\40\142\145\145\x6e\40\x72\157\x6c\154\145\144\x20\142\141\143\153\x20\x66\x6f\x72\40\x70\x61\143\153\141\x67\145\40" . $this->slug);
        return $this;
    }
}

Function Calls

None

Variables

None

Stats

MD5 f5e9dd0dd7ca9e668dcc431f172cdb19
Eval Count 0
Decode Time 55 ms