Laravel, how to manually install package without composer

Laravel, how to manually install package without composer

  1. Blog
  2. 15 November 2026
  3. 5 min read

Stefan Bogdanescu

Founder & Senior Architect

Laravel, how to manually install package without composer

You find yourself in a common but frustrating situation: you have a Laravel application running on a shared or free hosting environment where shell access is restricted, and the only tool available is FileZilla for FTP transfers. The maintainer of that server has locked down the command line, preventing you from running composer update or installing new dependencies directly. You need to add a specific package like Maatwebsite/Laravel-Excel, but Composer isn't an option.

This constraint forces you to manually intervene with the vendor directory and Laravel's autoloading mechanism. While this approach is generally considered a last resort because it breaks the dependency management lifecycle of the framework, there are legitimate scenarios—like the one described above—where you must do it. The core concept relies on understanding that Composer doesn't magically create files; it simply updates composer.json, runs scripts, and regenerates vendor/autoload.php. If you bypass Composer entirely, you have to replicate those steps manually.

Downloading the Package Directly

The first step is acquiring the package code. Since you cannot run composer require maatwebsite/laravel-excel, you must navigate to the package's GitHub repository or its official source and download the specific version you need.

If you are installing from GitHub, look for the release tags. For example, if the latest stable version is 3.1.x, ensure you clone or download that specific tag rather than the current main branch, as older Laravel versions may require older package versions. Download the ZIP archive and extract it into your project's root directory. You will likely see a folder named src containing the actual library code and potentially a config file.

You must manually copy the relevant files from the downloaded package into your application structure. For Maatwebsite/Laravel-Excel, this typically involves:

  1. Copying the contents of the src/ folder from the extracted package to your project's root (or specifically to app/).
  2. Ensuring any configuration files required by the package are placed in the correct location, usually within the config/ directory of your Laravel project.

Configuring the Autoload Path

This is the critical technical step that often trips up developers attempting manual installs. Laravel relies on composer.json to define where classes are located. Even if you haven't run Composer, the file likely exists and contains an autoload section generated by a previous installation or project setup.

You need to edit your project's composer.json. Locate the autoload array. It will look something like this:

"autoload": {
    "psr-4": {
        "App\\": "app/",
        "Maatwebsite\\Excel\\": "vendor/maatwebsite/Excel/src/"
    }
}

If you manually copied the package files into your root directory (e.g., laravel-project/maatewebsite-laravel-excel/src), you must update this path to reflect your actual file structure. If you placed the files inside a folder named vendor manually, ensure the paths point there.

Once you have updated the autoload section in composer.json to match your manual file placement, you must trigger the autoloader regeneration. Without running composer dump-autoload, Laravel will not know where these new classes live. You can simulate this by creating a temporary script or simply using the command line if available elsewhere, but strictly speaking, you need to execute:

php -r "require 'vendor/autoload.php';"

Wait, that doesn't regenerate it. To manually trigger the autoloader update without Composer, you can use Laravel's internal tools or a standalone script. However, the most reliable method without Composer is to use php artisan config:clear and php artisan cache:clear, but these won't rebuild the autoloader if composer.json hasn't been processed.

The robust workaround involves downloading the composer.phar file directly into your project folder (if PHP allows it via FTP) or using a local machine to generate the autoload file. If you cannot run any command on the server, you must upload a script that defines the class map manually. Alternatively, if you have access to a local machine, run:

composer dump-autoload

Then upload the resulting vendor/autoload.php (or specifically the updated classmap) back to the server via FileZilla. This ensures that when require 'vendor/autoload.php' is executed in your bootstrap file, it picks up the new classes.

Handling Configuration and Providers

Installing the code and updating the autoloader are only half the battle. Laravel packages often define Service Providers that need to be registered, and configuration files that need merging.

For Maatwebsite/Laravel-Excel, check if a Maatwebsite\Excel\ServiceProvider exists in your copied folder. If it does, you must ensure it is included in your application's service provider list. Open app/Providers/AppServiceProvider.php (or a dedicated config provider file) and add the import:

use Maatwebsite\Excel\ExcelServiceProvider;

Then, in the register() method, include it:

public function register()
{
    $this->app->register(ExcelServiceProvider::class);
}

Additionally, verify that config/excel.php is present in your project's config/ directory. If the manual installation didn't copy this file from the package source, you must create it with the necessary defaults defined in the package documentation or source code.

Why This Approach Is Risky

While solving your immediate problem, be aware that manual installation bypasses Composer's version resolution and dependency checking. You are responsible for ensuring that all external dependencies (like PHP versions or specific library requirements) are met. If a future update of Laravel breaks the package, you won't get a prompt to update via composer update.

Furthermore, if the server environment changes or if you need to deploy code from another machine, this manual setup might not replicate correctly because the composer.json no longer reflects reality. The autoloader file is static; it doesn't know about your current directory structure unless you meticulously maintain the paths.

In summary, manually installing packages without Composer requires direct manipulation of the vendor folder, precise editing of composer.json's autoload section, and manual registration of service providers. It is a viable workaround for restricted hosting environments, but it demands a deep understanding of how Laravel discovers classes and manages configuration to avoid runtime errors.

Our network