You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无Composer安装Laravel扩展包咨询(含Laravel Page Speed)

Hey there! Let's break down your two scenarios for installing the Laravel Page Speed extension (or any Laravel package) on your live site, especially since you're using Filezilla for FTP. I’ve been in this exact situation before, so here’s what actually works:

方案一:无需Composer安装扩展包

Manual installation is doable, but it requires careful file handling and configuration since you’re bypassing Composer’s dependency management. Here’s the step-by-step:

  • First, set up the extension locally on your computer:
    • Either create a temporary Laravel project matching your server’s Laravel/PHP version, then run composer require renatomarinho/laravel-page-speed to pull the package and its dependencies.
    • Or download the latest release archive from the package’s GitHub repo, but note this might miss required sub-dependencies.
  • Use Filezilla to upload the necessary files to your server:
    • Upload the entire vendor/renatomarinho/laravel-page-speed folder from your local project to the same path on your server (your site’s root vendor directory).
    • If you ran composer require locally, you’ll also need to upload any new dependency folders added to vendor (check your local composer.lock to see what else was installed).
    • Upload the generated config/pagespeed.php file (from your local config folder) to your server’s config directory.
  • Manually update Laravel’s configuration:
    • Open your server’s config/app.php file via Filezilla.
    • Add the service provider to the providers array:
      RenatoMarinho\LaravelPageSpeed\ServiceProvider::class,
      
    • If you want to use the facade, add this to the aliases array:
      'PageSpeed' => RenatoMarinho\LaravelPageSpeed\Facades\PageSpeed::class,
      
  • Clear Laravel’s cache (critical!):
    • If your host provides a way to run PHP commands (like cPanel’s Terminal or a task runner), execute:
      php artisan config:cache
      php artisan cache:clear
      
    • If not, manually delete all files in your server’s bootstrap/cache directory via Filezilla.

⚠️ Heads up: Manual installation risks missing hidden dependencies or version mismatches. Always test locally first before uploading to production.

方案二:使用Composer安装(推荐)

Composer is the safest way because it automatically manages dependencies and version compatibility. Here are two ways to do this based on your server’s capabilities:

情况A:服务器支持SSH连接(首选方法)

Most decent hosting providers offer SSH access—this is the easiest route:

  • Use an SSH client (like PuTTY, Xshell, or your local terminal) to connect to your server, then navigate to your Laravel project’s root directory.
  • If Composer isn’t installed on your server, run these commands first to set it up:
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    php composer-setup.php
    php -r "unlink('composer-setup.php');"
    
  • Install the extension with Composer:
    # If you have Composer globally installed
    composer require renatomarinho/laravel-page-speed
    
    # If you installed the phar file above
    php composer.phar require renatomarinho/laravel-page-speed
    
  • Publish the package’s configuration file (optional but recommended):
    php artisan vendor:publish --provider="RenatoMarinho\LaravelPageSpeed\ServiceProvider"
    
  • Clear cache to apply changes:
    php artisan config:cache
    

情况B:服务器仅支持FTP(your current setup)

If SSH isn’t an option, you can use your local Composer and upload the updated files:

  • On your local computer, create a Laravel project that matches your server’s exact Laravel version and PHP version (this avoids compatibility issues).
  • Run composer require renatomarinho/laravel-page-speed locally to install the package and all dependencies.
  • Use Filezilla to upload the updated vendor folder to your server. To be safe:
    1. First, download a backup of your server’s existing vendor folder (in case something breaks).
    2. Upload your local vendor folder, overwriting the server’s version. Alternatively, only upload the new folders added by the extension (check your local vendor for new entries).
  • Upload the generated config/pagespeed.php file to your server’s config directory (if you ran vendor:publish locally).
  • Clear the cache as described in the manual installation section (either via command line if possible, or delete bootstrap/cache files).

As for your earlier issue with CMD’s FTP command—don’t worry about that! Filezilla is way more user-friendly for FTP transfers, so stick with it.

内容的提问来源于stack exchange,提问作者jerome

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 08:02:26