!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/classify.picotech.app/public_html/vendor/spatie/laravel-package-tools/src/   drwxr-xr-x
Free 28.89 GB of 117.98 GB (24.49%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     PackageServiceProvider.php (7.29 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace Spatie\LaravelPackageTools;

use 
Carbon\Carbon;
use 
Illuminate\Support\Facades\View;
use 
Illuminate\Support\ServiceProvider;
use 
Illuminate\Support\Str;
use 
ReflectionClass;
use 
Spatie\LaravelPackageTools\Exceptions\InvalidPackage;

abstract class 
PackageServiceProvider extends ServiceProvider
{
    protected 
Package $package;

    abstract public function 
configurePackage(Package $package): void;

    public function 
register()
    {
        
$this->registeringPackage();

        
$this->package $this->newPackage();

        
$this->package->setBasePath($this->getPackageBaseDir());

        
$this->configurePackage($this->package);

        if (empty(
$this->package->name)) {
            throw 
InvalidPackage::nameIsRequired();
        }

        foreach (
$this->package->configFileNames as $configFileName) {
            
$this->mergeConfigFrom($this->package->basePath("/../config/{$configFileName}.php"), $configFileName);
        }

        
$this->packageRegistered();

        return 
$this;
    }

    public function 
newPackage(): Package
    
{
        return new 
Package();
    }

    public function 
boot()
    {
        
$this->bootingPackage();

        if (
$this->package->hasTranslations) {
            
$langPath 'vendor/' $this->package->shortName();

            
$langPath = (function_exists('lang_path'))
                ? 
lang_path($langPath)
                : 
resource_path('lang/' $langPath);
        }

        if (
$this->app->runningInConsole()) {
            foreach (
$this->package->configFileNames as $configFileName) {
                
$this->publishes([
                    
$this->package->basePath("/../config/{$configFileName}.php") => config_path("{$configFileName}.php"),
                ], 
"{$this->package->shortName()}-config");
            }

            if (
$this->package->hasViews) {
                
$this->publishes([
                    
$this->package->basePath('/../resources/views') => base_path("resources/views/vendor/{$this->packageView($this->package->viewNamespace)}"),
                ], 
"{$this->packageView($this->package->viewNamespace)}-views");
            }

            if (
$this->package->hasInertiaComponents) {
                
$packageDirectoryName Str::of($this->packageView($this->package->viewNamespace))->studly()->remove('-')->value();

                
$this->publishes([
                    
$this->package->basePath('/../resources/js/Pages') => base_path("resources/js/Pages/{$packageDirectoryName}"),
                ], 
"{$this->packageView($this->package->viewNamespace)}-inertia-components");
            }

            
$now Carbon::now();
            foreach (
$this->package->migrationFileNames as $migrationFileName) {
                
$filePath $this->package->basePath("/../database/migrations/{$migrationFileName}.php");
                if (! 
file_exists($filePath)) {
                    
// Support for the .stub file extension
                    
$filePath .= '.stub';
                }

                
$this->publishes([
                    
$filePath => $this->generateMigrationName(
                        
$migrationFileName,
                        
$now->addSecond()
                    ), ], 
"{$this->package->shortName()}-migrations");

                if (
$this->package->runsMigrations) {
                    
$this->loadMigrationsFrom($filePath);
                }
            }

            if (
$this->package->hasTranslations) {
                
$this->publishes([
                    
$this->package->basePath('/../resources/lang') => $langPath,
                ], 
"{$this->package->shortName()}-translations");
            }

            if (
$this->package->hasAssets) {
                
$this->publishes([
                    
$this->package->basePath('/../resources/dist') => public_path("vendor/{$this->package->shortName()}"),
                ], 
"{$this->package->shortName()}-assets");
            }
        }

        if (! empty(
$this->package->commands)) {
            
$this->commands($this->package->commands);
        }

        if (! empty(
$this->package->consoleCommands) && $this->app->runningInConsole()) {
            
$this->commands($this->package->consoleCommands);
        }

        if (
$this->package->hasTranslations) {
            
$this->loadTranslationsFrom(
                
$this->package->basePath('/../resources/lang/'),
                
$this->package->shortName()
            );

            
$this->loadJsonTranslationsFrom($this->package->basePath('/../resources/lang/'));

            
$this->loadJsonTranslationsFrom($langPath);
        }

        if (
$this->package->hasViews) {
            
$this->loadViewsFrom($this->package->basePath('/../resources/views'), $this->package->viewNamespace());
        }

        foreach (
$this->package->viewComponents as $componentClass => $prefix) {
            
$this->loadViewComponentsAs($prefix, [$componentClass]);
        }

        if (
count($this->package->viewComponents)) {
            
$this->publishes([
                
$this->package->basePath('/Components') => base_path("app/View/Components/vendor/{$this->package->shortName()}"),
            ], 
"{$this->package->name}-components");
        }

        if (
$this->package->publishableProviderName) {
            
$this->publishes([
                
$this->package->basePath("/../resources/stubs/{$this->package->publishableProviderName}.php.stub") => base_path("app/Providers/{$this->package->publishableProviderName}.php"),
            ], 
"{$this->package->shortName()}-provider");
        }


        foreach (
$this->package->routeFileNames as $routeFileName) {
            
$this->loadRoutesFrom("{$this->package->basePath('/../routes/')}{$routeFileName}.php");
        }

        foreach (
$this->package->sharedViewData as $name => $value) {
            
View::share($name$value);
        }

        foreach (
$this->package->viewComposers as $viewName => $viewComposer) {
            
View::composer($viewName$viewComposer);
        }

        
$this->packageBooted();

        return 
$this;
    }

    public static function 
generateMigrationName(string $migrationFileNameCarbon $now): string
    
{
        
$migrationsPath 'migrations/' dirname($migrationFileName) . '/';
        
$migrationFileName basename($migrationFileName);

        
$len strlen($migrationFileName) + 4;

        if (
Str::contains($migrationFileName'/')) {
            
$migrationsPath .= Str::of($migrationFileName)->beforeLast('/')->finish('/');
            
$migrationFileName Str::of($migrationFileName)->afterLast('/');
        }

        foreach (
glob(database_path("{$migrationsPath}*.php")) as $filename) {
            if ((
substr($filename, -$len) === $migrationFileName '.php')) {
                return 
$filename;
            }
        }

        return 
database_path($migrationsPath $now->format('Y_m_d_His') . '_' Str::of($migrationFileName)->snake()->finish('.php'));
    }

    public function 
registeringPackage()
    {
    }

    public function 
packageRegistered()
    {
    }

    public function 
bootingPackage()
    {
    }

    public function 
packageBooted()
    {
    }

    protected function 
getPackageBaseDir(): string
    
{
        
$reflector = new ReflectionClass(get_class($this));

        return 
dirname($reflector->getFileName());
    }

    public function 
packageView(?string $namespace)
    {
        return 
is_null($namespace) ? $this->package->shortName() : $this->package->viewNamespace;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0043 ]--