Download the PHP package portavice/bladestrap without Composer

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

Bladestrap = Blade + Bootstrap

PHP Tests Code style check Latest version Total downloads

Bladestrap provides Laravel Blade components for the Bootstrap 5 frontend framework.

Contents

Installation

First, install the package via Composer:

Within a Laravel application, the package will automatically register itself.

[!NOTE] If you only use parts of the Laravel framework (such as illuminate/view), make sure to follow the instructions in the section on usage without Laravel.

Install Bootstrap

Note that you need to include the Bootstrap files on your own.

  1. If you haven't added Bootstrap as one of your dependencies, you can do so via npm:

  2. Add the following to your webpack.mix.js to copy the required Bootstrap files to your public directory:

  3. Include CSS and JavaScript in resources/views/layouts/app.blade.php:

You may need to adjust the steps above to your custom project configuration. If you have a custom Bootstrap build you are responsible to include the necessary parts of Bootstrap yourself.

Configure Bladestrap

Usually this should not be necessary, but if you need to overwrite the default configuration, create and edit config/bladestrap.php:

Customize views

If you want to customize the views, publish them to resources\views\vendor\bladestrap\components and edit them to meet your requirements:

You may want to delete the views you haven't changed to benefit from package updates automatically.

Usage

The components are placed in the bs namespace, such that they can be used via:

Components can be enhanced with additional classes from Bootstrap or your own CSS.

Specifically handled attributes are documented with type annotations in the @props in the respective Blade template under resources/views/components.

Alerts

Alerts are of variant alert-info by default and can be dismissible (with a close button).

Badges

Badges are of variant badge-primary default:

Breadcrumb

The breadcrumb container is a <x-bs::breadcrumb> (typically placed within your layouts/app.blade.php):

Items can be added via <x-bs::breadcrumb.item :href="route('route-name')">Title</x-bs::breadcrumb.item>.

Buttons

To create buttons or button-like links with Bootstrap's btn-* classes you can use

To disable a button or link, just add disabled="true" which automatically adds the corresponding class and aria-disabled="true" as recommended by the Bootstrap documentation.

Button groups

Buttons can be grouped:

Button toolbars

Button groups can be grouped into a toolbar:

Dropdowns

Dropdown buttons can be added as follows:

The direction attribute can be used to set the direction of the dropdown overlay. It defaults to down. variant (default primary) is inherited from the button component.

Within the <x-slot:dropdown> you may place headers and items:

Note that Bootstrap's dropdowns require Popper, which needs to be included separately if you don't use Bootstrap's bootstrap.bundle.min.js.

Dropdown buttons within a button group require a nested button group and :nested-in-group="true" on the dropdown button:

Forms

Use <x-bs::form> to create forms (method defaults to POST), any additional attributes passed to the form component will be outputted as well:

Bladestrap will inject an CSRF token field for all methods except GET automatically. Bladestrap will also configure method spoofing for PUT, PATCH and DELETE forms.

Types of form fields

Bladestrap has wide support for Bootstrap's form fields.

Note that the content of the form field becomes the label. This allows to include icons etc. If you don't want to add a label, don't pass any content:

All attributes will be passed to the <input>, <select>, <textarea> - except

The following types are supported as values for the type attribute:

The types (marked with *) listed above don't have full browser support.

Options

Radio buttons, checkboxes and selects need a :options attribute providing an iterable of value/label pairs, e.g.

An Portavice\Bladestrap\Support\Options can be used to easily create an iterable based on

Additional options can be prepended/appended to an Options:

Radio buttons (allows to select one of multiple values):

Multiple checkboxes (allows to select multiple values):

Single checkbox (just one option):

Select (allows to select one of multiple values):

Multi-Select (allows to select multiple values):

Disabled, readonly, required

The attributes :disabled, :readonly, and :required accept a boolean value, e.g. :disabled="true" or :required="isset($var)".

Per default fields with :required="true" are marked with a * after the label. This behavior can be disabled via configuration (for all fields) or with :mark-as-required="false" (for a single field).

Input groups

To add text at the left or the right of a form field (except checkboxes and radio buttons), you can use the slots <x-slot:prependText> and <x-slot:appendText> which makes an input group:

By default, the appended/prepended text is wrapped within a <label> class="input-group-text" associated with the field. To avoid this, set :container="false" attribute on the slot which allows to define to add buttons for example:

Alternatively, an appendText slot can include a <x-bs::form.field:nested-in-group="true">:

Hints

<x-slot:hint> can be used to add a text with custom hints (.form-text) below the field, which will be automatically referenced via aria-describedby by the input:

Prefill values from query parameters

Setting :from-query="true" will extract values from the query parameters of the current route.

A form with the example field above on a page /my-page?filter[name]=Test will set "Test" as the prefilled value of the field, while /my-page will have an empty value.

To pass default filters applied if no query parameters are set, use ValueHelper::setDefaults:

Error messages

All form fields show corresponding error messages automatically if present (server-side validation). If you want to show them independent of a form field, you can use the component directly:

Both <x-bs::form.feedback> and <x-bs::form.field> support to use another than the default error bag via the :errors attribute.

Links

Colored links can be placed via <x-bs::link>, the attributes opacity and opacityHover define opacity.

List groups

<x-bs::list> is a list group, a container for multiple <x-bs::list.item>. :flush="true" enables flush behavior, :horizontal="true changes the layout from vertical to horizontal.

Items can be added via <x-bs::list.item>:

:active="true" highlights the active item, :disabled="true" makes it appear disabled.

Modals

Modals can be created via <x-bs::modal> with optional slots for title and footer. Both slots accept additional classes and other attributes. If you don't want a <h1> container for the title, change it via container="h2" etc.

<x-bs::modal> supports the following optional attributes:

A <x-bs::modal.button modal="my-modal"> opens the modal with the ID my-modal. You may pass any additional attributes as known from <x-bs::button>.

Navigation

<x-bs::nav> creates a nav container, use container="ol" to change the container element from the default <ul> to <ol>.

Navigation items can be added via <x-bs::nav.item href="{{ route('route-name') }}">Current Page</x-bs::nav.item>.

A navigation item may open a dropdown if you enabled this by adding a dropdown slot:

Usage without Laravel

Bladestrap uses config() and request() helpers. If you want to use Bladestrap without Laravel, you need to define the two helpers in your application, for example (may need to be adapted to the framework you use):

In addition, you have to do the registrations of the BladestrapServiceProvider yourself:


All versions of bladestrap with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/console Version ^10.24|^11.0|^12.0
illuminate/http Version ^10.24|^11.0|^12.0
illuminate/support Version ^10.24|^11.0|^12.0
illuminate/view Version ^10.24|^11.0|^12.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 portavice/bladestrap contains the following files

Loading the files please wait ....