Download the PHP package othyn/laravel-toastie without Composer

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

Laravel Toastie

Simple Toast notifications with built in default designs for ALT stack (Alpine, Laravel, Tailwind) applications with easy options to customise to your hearts content.

tests stan lint coverage downloads contributors forks stars open issues license

Install Latest Version · Report Bug · Request Feature

:notebook_with_decorative_cover: Table of Contents

:star2: About the Project

All the other Laravel Toast notification libraries out there seemed to have nailed the API for creating Toasts, but the key areas they were lacking in are keeping up to date and :sparkles: style :sparkles:.

This package aims to solve that by providing a default set of Toasts that look good and are easy to use, with it being very easy to change up the design if you hate the look of them and roll your own!

Toastie has support for 4 key toast types/states; Success, Info, Warning and Error.

:camera: Screenshots

 

 

:space_invader: Tech Stack

:dart: Features

:floppy_disk: Install

Installation can be done via Composer:

After installation you will need to do a fresh build of any assets via your frontend build tool of choice, which is probably Vite. This is so that the Tailwind bundler can pickup the new views and load in the classes the package uses (if they haven't already been bundled via usage elsewhere in your application) into your app bundles. You may also need to restart any Docker containers if you are still having issues.

Next you are going to want to head down to the usage! See you there.

Version Matrix

Here is the current version matrix for project supported versions of used frameworks and libraries.

Toastie Version PHP Version Laravel Version Alpine Version Tailwind Verison
1.0.0 ^8.1 ^9.24 ^3.4.2 ^3.1.0

If you require support for an older version of Laravel, submit an issue as we may be able to look into dropping the version requirements down, as I don't think it needs to be this new. Or, feel free to submit a PR!

:hammer_and_wrench: Usage

There are three key parts to Toastie;

  1. The configuration.
    • Where you can customise Toastie's behaviour.
  2. The PHP API.
    • How you can call and action Toastie.
  3. The Blade components.
    • How you can render Toastie.

Let's kick things off with the configuration, I'll meet you down there.

:wrench: Configuration

Hello again! First thing we're going to need to do is publish the configuration so we can set things up how we want them.

We do this my telling Laravel to publish the config file into our working directory, instead of relying on the default one bundled with this package:

You should now have an config/toastie.php file within your project that you can edit. If you go ahead and open it up, you'll see something like:

Customise this to your hearts content, the configuration options available and a short description are provided above or in your new config/toastie.php file.

Let's move onto the PHP API.

:elephant: PHP API

Calling Toastie can be achieved one of three ways;

Choose whichever way you prefer to do things. I'm partial for the helper method myself, its nice and easy with good IDE type hinting.

The helper method

If you prefer taking things easy:

The Facade

If you prefer a more static way of life:

You'll notice that the Facade has the concrete class as a mixin on the PHPDoc blocks, this so you're IDE will be happy. I know mine is.

The class instance

If you like things old school:

Let's move onto the Blade Components.

:page_facing_up: Blade Components

By default, Toastie ships with a Toast design and paired component for all of the 4 key toast types that it supports. It also has some 'smarter' options and options that allow you to customise the appearance to your heards content whilst retaining Toastie's expressive API.

In order to have Toastie load toasts onto your page, you'll need to do one of three things;

By 'can be overridden', I'm refering to the fact that under those scenarios the actual underlying component file is loaded, meaning you can publish the views for the project and customise them to your hearts content, completely changing the design if you wish but retaining Toastie's expressive API. If you want to know how to do this, skip ahead to 'Customising the toast design'.

Let's kick things off with Toastie's default implementation.

Using the dynamic default design

This is the easiest way to maximise the utilisation of Toastie if you are not wanting to change up any of the designs.

That's it! You're now using Toastie, just call Toastie via one of the PHP API methods described above and watch as toast goes everywhere! Enjoy!

Under the hood, this dynamically renders the default toast design, meaning this one isn't overridable - that functionality is reserved for the next two options so keep reading if that's what you want.

This should be the go to option for people just wanting Toastie to do all the work, so you can kick back and have another sip of coffee. Ahhhhhhhh.

Let's move on.

Using individual style/type components

This is the hardest, but most custom, utilisation of the Blade components:

As you can see this is highly customisable, as you can place each toast somewhere different to render if you so wish. If you want to know how to do this, skip ahead to 'Customising the toast design'.

But having 4 lines is silly to get you access to all the components, which is where the next component comes in.

Lazy loading all components

This is the easiest way to maximise the utilisation of the Blade components whilst still retaining full control of the design:

By design, this will only ever render the required component should it have been called by you calling Toastie on the last page cycle.

Under the hood, its just pulling in each component directly, meaning if you want to override the styles this will allow you to still render all of the toasts whilst using your nice new designs. If you want to know how to do this, skip ahead to 'Customising the toast design'.

Customising the toast design

So, don't like that default Toastie design eh? Well then, I suppose I better tell you how to change it. First, we need to publish Toastie's view set into your project so you can customise it:

You should now have a load of view files appear in a new resources/views/vendor/toastie/components directory within your project that you can now edit to your hearts content.

To explain the files that you are seeing, in alphabetical order:

Each Blade component gets access to the following variables:

:bread: Contributing

See the contribution guide on how to get started. Thank you for contributing!

Detailed within that guide are steps on how...

:toolbox: Project Tooling Quick Reference

There are quite a few ease-of-use tools in place to help you manage the project, all of which are masked behind Make and Docker to make using this project as smooth as possible.

That's about it, go make something cool and submit a PR!

:warning: License

Distributed under the MIT License. See LICENSE for more information.

:gem: Acknowledgements

Useful resources and libraries that have been used in the making of this project.


All versions of laravel-toastie with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^9.24
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 othyn/laravel-toastie contains the following files

Loading the files please wait ....