Download the PHP package guidofaecke/blast-base-url without Composer

On this page you can find all versions of the php package guidofaecke/blast-base-url. 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 blast-base-url

Blast\BaseUrl

Just another fork of mtymek/blast-base-url... Not exactly! The development of mtymek/blast-base-url apparently stopped in 2019, so here we go, strip the cruft and get back to PHP7.4 - 8.1

This package detects base URL of web application. It is useful when you need your app to be served from subdirectory (like http://localhost/my-project/public). This can be useful sometimes, especially in development environment.

View helpers for working with assets are also provided in the package.

Detection logic is based on laminas-http package.

Installation

Installation is supported using Composer:

If Zend Component Installer is present, it will automatically update application configuration.

Usage

For simplicity, following instructions are targeting applications based on Mezzio Skeleton, assuming that laminas/laminas-servicemanager was selected as DI container.

Blast\BaseUrl is based on PSR-7, so it will work well with other frameworks/dispatchers like Slim3 or Relay, just that wiring process will look different.

Base URL Middleware

Add BaseUrlMiddleware to your pipeline, just before routing middleware (config/pipeline.php file):

BaseUrlMiddleware will alter path from request URI, stripping base url. It means that even if you access your project from http:/localhost/~user/project/public/index.php/foo/bar, next middleware in the pipe will see the path as /foo/bar.

Additionally, two attributes will be added to ServerRequest, holding base URL and base path:

Generating URLs

BaseUrlMiddleware is able to automatically configure UrlHelper, so that all URLs generated by this helper will have appropriate prefix. This will be done automatically if UrlHelper is available in service container.

Accessing assets - base path

Another feature provided by this package is base path helper. It can be used to generate URLS for your asset files that work correctly under subdirectory.

If BasePathHelper is available, BaseUrlMiddleware will automatically configure it during execution.

Zend View

You will be able to use following syntax inside zend-view templates:

Depending on your application directory, it will produce something similar to:

Twig

You will be able to use following syntax inside twig templates:

Depending on your application directory, it will produce something similar to:


All versions of blast-base-url with dependencies

PHP Build Version
Package Version
Requires php Version ~8.2.0|~8.3.0
psr/http-message Version ^1.0|^2.0
psr/http-server-handler Version ^1.0|^2.0
psr/http-server-middleware Version ^1.0|^2.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 guidofaecke/blast-base-url contains the following files

Loading the files please wait ....