Download the PHP package giftcards/mod-rewrite without Composer

On this page you can find all versions of the php package giftcards/mod-rewrite. 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 mod-rewrite

Mod Rewrite Build Status

Purpose

The mod rewrite library is meant to be a php implementation of mod rewrite. it can read the same directives given to the apache rewrite engine module and use them to rewrite given urls the same way as apache would.

Support

RewriteRule, RewriteCond, RewriteEngine are supported with the caveat that certain server variables are not implemented yet in the replacements system as well as a bunch of the more advanced rewriting flags for the RewriteRule directive arent implemented. Adding support for these features as well as the other directives is pretty straightforward through extension it just hasn't been done yet. At the moment only the server variables QUERY_STRING, REQUEST_URI, REQUEST_FILENAME, HTTP_HOST are supported. Feel free to PR support for more!

Usage

Basic

if you just want to use the stock rewriter with a file you just need to use the 2 builders to build the rewriter and the file compiler

the $result is an instance of Giftcards\ModRewrite\Result you can get the rewritten url from getUrl() this will be populated whether it was matched and rewritten by a rule or not. You can get the rule that was matched from getMatchedRule(). the rule contains the rewrite directive as well as the condition directives. If no rule was matched getMatchedRule() will return null.

Note: make sure your urls are decoded before passing them to the rewriter since it could cause odd things if it's not decoded

Processor

The processor class can be used to process a submitted request along with a matched result and spit out a result. After processing the request according to the rules given it will either return a clone of the given request with the query and uri changed according to the matched rule, or a Symfony\Component\HttpFoundation\Response if the rule says to return some sort of status code or redirect (R|redirect, F|forbidden, G|gone etc). You can use these as they are in your application to either the forward a request or return a response

Formatters

Formatters are the clases that do all the replacing of values in the TestString and CondPattern in the RewriteCond as well as the Substitution in the RewriteRule in the default rewriter setup. In the Formatters dir there are a bunch there

by default all of these are added to a chain formatter and run in the order they were added you can add as many formatters as you want they have to implement Giftcards\ModRewrite\Formatter\FormaterInterface

Condition Predicate Checkers

the condition predicate checkers are the classes that after a rule matches are used to check the conditions attached to the rule. in the Condition there are a bunch already defined

all predicate checkers have a supports method. this allows them to be added to a chain checker which will check to see if any checkers in the chain support the condition pattern (predicate) the chain will throw an exception if no supporting checker is found. the chain allows you to set a default checker to run instead if you dont want an exception thrown. in the default setup the existence checker is added to the chain, the regex checker is set as the default. the chain then passed into the not checker which is passed into the formatting checker.


All versions of mod-rewrite with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
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 giftcards/mod-rewrite contains the following files

Loading the files please wait ....