Download the PHP package vanio/vanio-web-bundle without Composer

On this page you can find all versions of the php package vanio/vanio-web-bundle. 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 vanio-web-bundle

Vanio Web Bundle

Build Status Coverage Status PHP7 License

Installation

Installation can be done as usually using composer. composer require vanio/vanio-web-bundle

Next step is to register this bundle as well as bundles it depends on inside your AppKernel.

Features

Detecting request type

To detect whether current request is master or sub request, special request attribute _request_type is set. This logic happens inside Vanio\WebBundle\Request\RequestTypeListener listener which is not registered by default. Enable this feature by setting detect_request_type configuration parameter to true.

Redirecting to Referer

It's quite a common task to redirect user back after certain actions. This bundle defines a service named vanio_web.request.referer_resolver which helps you with that. First it tries to read from _referer (%vanio_web.referer_parameter%) query parameter. When the query parameter is not present then it reads HTTP_REFERER header and tries to match the referring URL against defined routes. In case of missing header or invalid URL (like URL pointing to a different webpage) fallback path is used. Since this functionality is mostly used from inside controllers, it is possible to use Vanio\WebBundle\Request\RefererHelperTrait which defines one method - redirectToReferer(string $fallbackPath = null): RedirectResponse.

Flash Messages

Another thing which seems too complicated to me is translating of flash messages. It's actually very easy but you need a session and a translator. Two dependencies just to show a translated flash message. To simplify that there is Vanio\WebBundle\Translation\FlashMessage value object you can use as an envelope of the message and pass the message parameters and domain to it. This bundle also replaces translation.extractor.php service with implementation able to extract messages from FlashMessage constructor.

But adding a flash message is just half of the problem. You'll also need to display it somewhere in your view and actually translate it yourself.

Validation of required fields

The required option normally affects only the HTML5 required attribute. This bundle allows setting of validate_required: true to automatically add a NotBlank constraint to the form. The default validation message is configurable by setting required_message.

Form state URL canonization

Due to SEO optimizations and also in situations where having full form state serialized in URL is too long and ugly it is possible to set canonize: true in form options. When you submit the form it is then redirected to canonical URL where all empty form fields (even those equal to empty_data option) are ommited.

Templating

Generating class name

Sometimes, even just generating a class name of HTML elements can be cumbersome when it depends on some conditions. Let's use class_name(array $classes): string Twig function. You need to pass it an array where key is a class and value is a boolean value indicating whether this class name should be present.

Checking whether a text is translated

To check whether text is translated you can use is_translated(string $id, string $locale = null) Twig function which checks translator's catalogue. The text is considered as translated when it is present in the catalogue and the translation does not equal to false.

Determining current menu item

To determine whether a current request matches a menu item, use is_current(string $route): bool Twig function. The route is considered current when either _route request attribute equals to the given route or when request pathinfo starts with the route path and it's delimited by /.

Testing whether a given object implements a given type

In Twig, there is no possibility how to determine whether a given object implements a given type. So, for example, it is not possible to determine whether a flash message is just a string or an instance of the added FlashMessage class. And that's why instance of(string $class) Twig test was added. You can use it like this:

Removing values from arrays

Removing certain values from an array is possible using without(array $array, $values) Twig filter. Pass it either a value or an array of values to remove and it will return a new array with the given values being unset.

Removing keys from arrays

Removing certain keys from an array is possible using without(array $array, $keys) Twig filter. Pass it either a string or an array of keys to remove and it will return a new array with the given keys being unset.

Removing empty values from arrays

Removing empty values from an array is possible using withoutEmpty(array $array) Twig filter. Value is considered empty using the same implementation as empty Twig test ('', false, null, [], or instances of Countable with zero length).

Replacing based on regular expressions

The builtin replace Twig filter uses strtr under the hood but there is no support for replacing based on regular expressions. So we've implemented regexp_replace(string $string, $pattern, $replacement) filter. You can pass it either an array with keys as regular expressions and values as replacements or when the replacement argument is provided then the pattern can be either a string or an array (keys are ignored).

Converting HTML to plaintext

Have you ever created an HTML e-mail? Providing plaintext alternative manually is tedious so html_to_text(string $html, array $options = []): string Twig filter is your friend in such cases. It uses handy html2text library.

Default Configuration


All versions of vanio-web-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
symfony/security-bundle Version ^3.0
symfony/translation Version ^3.0
symfony/form Version ^3.0
symfony/twig-bridge Version ^3.0
sensio/framework-extra-bundle Version ^3.0 || ^4.0 || ^5.0
twig/twig Version ^1.24.1 || ^2.0
vanio/stdlib Version ~0.1
vanio/type-parser Version ^0.1
html2text/html2text Version ^4.0.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 vanio/vanio-web-bundle contains the following files

Loading the files please wait ....