Supported Versions: PHP 4 >= 4.0.3, PHP 5, PHP 7, PHP 8
Returns information about a file path
<?php pathinfo(string $path, int $flags = PATHINFO_ALL): array|string
<?php     public function filename()

    {

        return pathinfo($this->path())['filename'];

    }
<?php     public function basename()

    {

        return pathinfo($this->path())['basename'];

    }
<?php     public function folder()

    {

        $dirname = pathinfo($this->path())['dirname'];



        return $dirname === '.' ? '/' : $dirname;

    }
<?php         $filename = $filename ?: $this->filename();

        $oldPath = $this->path();

        $oldMetaPath = $this->metaPath();

        $newPath = Str::removeLeft(Path::tidy($folder.'/'.$filename.'.'.pathinfo($oldPath, PATHINFO_EXTENSION)), '/');



        if ($oldPath === $newPath) {

            return $this;
<?php     public function upload(UploadedFile $file)

    {

        $ext = $file->getClientOriginalExtension();

        $filename = $this->getSafeFilename(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME));

        $basename = $filename.'.'.$ext;



        $directory = $this->folder();
<?php     protected function ensureUniqueFilename($folder, $filename, $count = 0)

    {

        $extension = pathinfo($this->path(), PATHINFO_EXTENSION);

        $suffix = $count ? " ({$count})" : '';

        $newPath = Str::removeLeft(Path::tidy($folder.'/'.$filename.$suffix.'.'.$extension), '/');
<?php     public function basename()

    {

        return pathinfo($this->path(), PATHINFO_BASENAME);

    }



    public function title()
<?php     public function title()

    {

        return pathinfo($this->path(), PATHINFO_FILENAME);

    }



    public function disk()
<?php         File::makeDirectory("{$base}/{$this->siteOne()}");



        File::getFiles($base)->each(function ($file) use ($base) {

            $filename = pathinfo($file, PATHINFO_BASENAME);

            File::move($file, "{$base}/{$this->siteOne()}/{$filename}");

        });

    }
<?php {

    public function __invoke($path)

    {

        $filename = pathinfo($path, PATHINFO_FILENAME);



        if (strpos($filename, '.') === false) {

            return null;
<?php             return null;

        }



        $firstSegment = explode('.', pathinfo($path, PATHINFO_FILENAME), 2)[0];



        return $this->isDate($firstSegment) ? $firstSegment : null;

    }
<?php {

    public function __invoke($path)

    {

        $path = pathinfo($path, PATHINFO_FILENAME);



        if (strpos($path, '.') === false) {

            return $path;
<?php {

    public function __invoke($path)

    {

        $filename = pathinfo($path, PATHINFO_FILENAME);



        if (strpos($filename, '.') === false) {

            return null;
<?php             return null;

        }



        $segments = explode('.', pathinfo($path, PATHINFO_FILENAME));



        if ($this->isDate($segments[0])) {

            return $segments[2] ?? null;
<?php             return $path;

        }



        $ext = pathinfo($path, PATHINFO_EXTENSION);



        $pathWithoutExtension = substr($path, 0, -(strlen($ext) + 1));