Download the PHP package phpwatch/laravel-fast404 without Composer

On this page you can find all versions of the php package phpwatch/laravel-fast404. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-fast404

Laravel Fast 404

Laravel Fast 404

Laravel Fast 404 is a Laravel package that adds a global middleware to your Laravel application to immediately terminate HTTP(s) requests for non-HTML 404 requests. This prevents unnecessary database connections and your application from fully bootstrapping to serve an HTML page that nobody will see.

This is done by inspecting every incoming HTTP request's "Accept" header and the URI path. If the URI path ends with a known static file extension (such as .jpg, .png, .woff, etc), and the Accept header does not mention text/html (which is the case when browsers request images, web fonts, JS files, CSS files, etc), the request is immediately terminated by this middleware.

Latest Stable Version Total Downloads License CI

Requirements

Installation

Upon installation, Laravel will automatically register the Service Provider bundled with this package, which will in turn register middleware and the Fast404Middleware service automatically.

Configuration

You can configure the message, the regular expression used to match URI patterns (e.g. a list of file extensions), and optionally an exclusion regular expression.

From configuration files

Update your config/app.php file, and add the following configuration to the existing array:

All configuration values must be strings.

Configuration Default Value Description
message Not Found The message to be shown when this package terminates a request. It might contain HTML. Try to keep the message short.
regex /\.(?:js\|css\...woff2)$/i A full regular expression to match against the request URI (without base-URI and URL parameters). If matched, this package will attempt to terminate the request. The default value will be used if null is passed. Make sure to include expression delimiters and flags if necessary. It is recommended to keep the default value.
exclude_regex null An optional regular expression to match, and if matched, this package will not terminate the request even if the exclude expression matched positive. This can be used to declare exclusion patterns if your Laravel application generates images on-the-fly, provides dynamic .js files, etc.

File type extensions

The default regular expression is:

This creates a non-capturing group of file types separated by the pipe (|) symbol above.

By updating the service provider (advanced)

This package bundles a Service Provider that conveniently enables middleware. You can turn this feature off if you wish to configure the middleware to your liking.

Step 1: Remove the automatic provider discovery for this library

In your root composer.json file, add/merge configuration directives:

Step 2: Add the middleware

In your application App/Http/Kernel.php file, prepend the Middleware provided by this package.

Make sure to add \PHPWatch\LaravelFast404\Fast404Middleware::class, to the top because middlewares are run in the order they are declared.

Optional step 3: Register a service provider for further customizations

If you would like to configure the middleware to change the message, file extensions, or the exclusion pattern, you will need to register it in the Service Container.

To do so, you can either create a new service provider, or update an existing one to declare how the \PHPWatch\LaravelFast404\Fast404Middleware class is instantiated.

Contributions

Contributions are welcome! Please feel free to send a PR or open an issue. Please note that this Laravel package is in the same line as phpwatch/fast404 and phpwatch/wordpress-fast404 packages, and the extensions list updates will be made to all packages in a framework-agnostic way.


All versions of laravel-fast404 with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4
illuminate/http Version ^5.5 || ^6.0 || ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phpwatch/laravel-fast404 contains the following files

Loading the files please wait ....