Giter Site home page Giter Site logo

jnessier / flash Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 0.0 81 KB

NOT MAINTAINED ANYMORE. Flash messages service for Slim 4 and similar PSR-15 compliant frameworks or apps.

License: MIT License

PHP 100.00%
flash-messages php73 psr-11 psr-15 slim slim-framework slim4

flash's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flash's Issues

addMessage should add a message, not set the group to the message

Hi

This morning I've tried to use your library and I fear that I stumbled on a simple bug: Flash::addMessage() should add the message not set the key to the message...

The current code is

    /**
     * {@inheritDoc}
     */
    public function addMessage(string $key, $message): FlashInterface
    {
        if (!isset($this->next[$key])) {
            $this->next[$key] = [];
        }

        $this->next[$key] = $message;

        return $this;
    }

but adding the message should imo be:

        $this->next[$key][] = $message;

Since you did define the return type of getMessages() php gave me a nice error instead of simply returning the wrong data : - ).

I will keep on testing your library, but, for now, it seems to do its job!

Make the project compatible with php 8.0

I'm using FlashMessages with PHP 8.0.x and it works well.

Can you please update composer.json to accept versions of PHP that are newer than 7.4?

As an example by setting

"php": ">=7.3"

or

"php": "^7.3 ||^8.0"

(supposing that it has not been tested with 8.1...

addCurrentMessage() ?

I normally plan to add the Flash Message to next.

But, I currently have one use case for messages that need to be rendered in the current session. And I'd prefer not to use a second library just for that...

I'd like to suggest to add addCurrentMessage to Flash.php.

(Of course I could use getCurrent() and setCurrent() but that's a huge hack!)

I can make a pull request if you agree with the idea.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.