Skip to content

Magento2 alternative class of Zend_Filter_BaseName in magento 2.4.6 [closed]

when i download log file from admin then this error occur
Error: Class “Zend_Filter_BaseName” not found in app/code/vendor/module/Controller/adminhtml/Download/GetLog.php
Here is that file.

‘<?php
namespace vendormoduleControllerAdminhtmlDownload;

use MagentoBackendAppActionContext;
use MagentoBackendControllerAdminhtmlSystem;
use MagentoFrameworkAppResponseHttpFileFactory;
use MagentoFrameworkExceptionNotFoundException;
use Zend_Filter_BaseName;

abstract class GetLog extends System
{
protected $fileFactory;
public function __construct(Context $context, FileFactory $fileFactory)
{
$this->fileFactory = $fileFactory;
parent::__construct($context);
}

public function execute()
{
    $param = $this->getRequest()->getParams();
    $filePath = $this->getFilePathWithFile($param[0]);

    $filter   = new Zend_Filter_BaseName();
    $fileName = $filter->filter($filePath);
    try {
        return $this->fileFactory->create(
            $fileName,
            [
                'type'  => 'filename',
                'value' => $filePath
            ]
        );
    } catch (Exception $e) {
        throw new NotFoundException(__($e->getMessage()));
    }
}

}’