basename

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Returns trailing name component of path
<?php basename(string $path, string $suffix = ""): string
<?php     public function getMigrationName($path)

    {

        return str_replace('.php', '', basename($path));

    }
<?php         $path = realpath($path) ?: $path;



        $tempPath = tempnam(dirname($path), basename($path));




        if (! is_null($mode)) {
<?php         $headers['Content-Length'] ??= $this->size($path);



        if (! array_key_exists('Content-Disposition', $headers)) {

            $filename = $name ?? basename($path);



            $disposition = $response->headers->makeDisposition(

                $disposition, $filename, $this->fallbackName($filename)
<?php         foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) {

            $directory = $this->getNestedDirectory($file, $configPath);



            $files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath();

        }



        ksort($files, SORT_NATURAL);
<?php         $config = [];



        foreach (Finder::create()->files()->name('*.php')->in(__DIR__.'/../../../../config') as $file) {

            $config[basename($file->getRealPath(), '.php')] = require $file->getRealPath();

        }



        return $config;
<?php         $name = (string) (is_null($this->argument('name')) ? select(

            label: 'Which configuration file would you like to publish?',

            options: collect($config)->map(function (string $path) {

                return basename($path, '.php');

            }),

        ) : $this->argument('name'));
<?php         $config = [];



        foreach (Finder::create()->files()->name('*.php')->in(__DIR__.'/../../../../config') as $file) {

            $name = basename($file->getRealPath(), '.php');



            $config[$name] = file_exists($stubPath = (__DIR__.'/../../../../config-stubs/'.$name.'.php')) ? $stubPath : $file->getRealPath();

        }
<?php         $class = trim(Str::replaceFirst($basePath, '', $file->getRealPath()), DIRECTORY_SEPARATOR);



        return str_replace(

            [DIRECTORY_SEPARATOR, ucfirst(basename(app()->path())).'\\'],

            ['\\', app()->getNamespace()],

            ucfirst(Str::replaceLast('.php', '', $class))

        );
<?php             )->disk($disk);



            $attachment

                ->as($attachment->as ?? basename($path))

                ->withMime($attachment->mime ?? $storage->mimeType($path));



            return $dataStrategy(fn () => $storage->get($path), $attachment);
<?php             $message->attachData(

                $storage->get($attachment['path']),

                $attachment['name'] ?? basename($attachment['path']),

                array_merge(['mime' => $storage->mimeType($attachment['path'])], $attachment['options'])

            );

        }
<?php         $this->diskAttachments = collect($this->diskAttachments)->push([

            'disk' => $disk,

            'path' => $path,

            'name' => $name ?? basename($path),

            'options' => $options,

        ])->unique(function ($file) {

            return $file['name'].$file['disk'].$file['path'];
<?php         return collect($this->diskAttachments)->contains(

            fn ($attachment) => $attachment['disk'] === $disk

                && $attachment['path'] === $path

                && $attachment['name'] === ($name ?? basename($path))

                && $attachment['options'] === $options

        );

    }
<?php     {

        $reflection = new ReflectionFunction($this->closure->getClosure());



        return 'Closure ('.basename($reflection->getFileName()).':'.$reflection->getStartLine().')';

    }

}
<?php     {

        $class = is_object($class) ? get_class($class) : $class;



        return basename(str_replace('\\', '/', $class));

    }

}
<?php     public function basename($suffix = '')

    {

        return new static(basename($this->value, $suffix));

    }