Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

Commit

Permalink
Implement initial feature set (#1)
Browse files Browse the repository at this point in the history
* Implement initial feature set

* Apply fixes from StyleCI (#2)
  • Loading branch information
claudiodekker authored Oct 29, 2018
1 parent 5e1e246 commit 1e75267
Show file tree
Hide file tree
Showing 16 changed files with 4,169 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/vendor/
phpunit.xml
33 changes: 33 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
filter:
excluded_paths: [tests/*]
checks:
php:
code_rating: true
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true
tools:
external_code_coverage: false
php_analyzer: true
php_code_coverage: false
php_code_sniffer:
config:
standard: PSR2
filter:
paths: ['src']
php_loc:
enabled: true
excluded_dirs: [vendor, tests]
php_cpd:
enabled: true
excluded_dirs: [vendor, tests]
1 change: 1 addition & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
preset: laravel
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
sudo: required

language: php

php:
- 7.1
- 7.2

env:
matrix:
- COMPOSER_FLAGS="--prefer-lowest"
- COMPOSER_FLAGS=""

before_install:
- travis_retry composer self-update

install:
- travis_retry composer update --prefer-source $COMPOSER_FLAGS

script:
- phpunit

branches:
only:
- master
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

All notable changes to `ubient/laravel-flash-message` will be documented in this file

## 1.0.0 - 2018-10-29

- Initial release
55 changes: 55 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

Please read and understand the contribution guide before creating an issue or pull request.

## Etiquette

This project is open source, and as such, the maintainers give their free time to build and maintain the source code
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
extremely unfair for them to suffer abuse or anger for their hard work.

Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
world that developers are civilized and selfless people.

It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.

## Viability

When requesting or submitting new features, first consider whether it might be useful to others. Open
source projects are used by many developers, who may have entirely different needs to your own. Think about
whether or not your feature is likely to be used by other users of the project.

## Procedure

Before filing an issue:

- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
- Check to make sure your feature suggestion isn't already present within the project.
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
- Check the pull requests tab to ensure that the feature isn't already in progress.

Before submitting a pull request:

- Check the codebase to ensure that your feature doesn't already exist.
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.

## Requirements

If the project maintainer has any additional requirements, you will find them listed here.

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.

**Happy coding**!
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Laravel Flash Message

[![Latest Version](https://img.shields.io/github/release/ubient/laravel-flash-message.svg?style=flat-square)](https://github.com/ubient/laravel-flash-message/releases)
[![Build Status](https://img.shields.io/travis/ubient/laravel-flash-message/master.svg?style=flat-square)](https://travis-ci.org/ubient/laravel-flash-message)
[![Quality Score](https://img.shields.io/scrutinizer/g/ubient/laravel-flash-message.svg?style=flat-square)](https://scrutinizer-ci.com/g/ubient/laravel-flash-message)
[![StyleCI](https://styleci.io/repos/154986115/shield)](https://styleci.io/repos/154986115)
[![Total Downloads](https://img.shields.io/packagist/dt/ubient/laravel-flash-message.svg?style=flat-square)](https://packagist.org/packages/ubient/laravel-flash-message)

This package provides a Laravel Flash Message that can be used to display an one-time status message to your users.

## Usage

When redirecting, you can fluently chain one of the [available methods](#available-methods), similar to how you would [flash other session data](https://laravel.com/docs/5.7/redirects#redirecting-with-flashed-session-data):

```php
return redirect()
->route('login')
->withErrorMessage('To execute this action, you need to be logged in first.');
```

With the message flashed to the session, all that remains is to display it to your users.
A good place to start doing so, is by including the alert we've shipped with this package into your view(s):
```php
@include('flash-message::alert')
```

#### Available Methods

- `withInfoMessage('Message')`: Flashes a message that indicates a neutral informative change or action.
- `withSuccessMessage('Message')`: Flashes a message that indicates a successful or positive action.
- `withWarningMessage('Message')`: Flashes a message that indicates a warning that might need attention.
- `withErrorMessage('Message')`: Flashes a message that indicates an erroneous, dangerous or negative action.


### Customizing the template
By default, our alert uses [TailwindCSS](https://github.com/tailwindcss/tailwindcss)'s utility classes to style the alert,
but odds are you're either using something else or want to modify how the alert looks altogether.
Luckily, doing so is fairly easy:

1. Publish our template into your application by running the following artisan command:
```bash
php artisan vendor:publish --provider="Ubient\FlashMessage\FlashServiceProvider"
```
2. Modify the template located at `resources/views/vendor/flash-message/alert.blade.php`.
3. That's all! Laravel will automatically pick up on the changes you've made.


## Installation

You can install the package via composer:

```bash
composer require ubient/laravel-flash-message
```

The package will automatically register itself.

## Testing

You can run the test using:

``` bash
vendor/bin/phpunit
```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

## Security

If you discover any security related issues, please email claudio@ubient.net instead of using the issue tracker.

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
51 changes: 51 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "ubient/laravel-flash-message",
"description": "ubient/laravel-flash-message",
"keywords": [
"ubient",
"laravel-flash-message",
"laravel",
"flash",
"message",
"alert",
"notification"
],
"homepage": "https://github.com/ubient/laravel-flash-message",
"license": "MIT",
"authors": [
{
"name": "Claudio Dekker",
"email": "claudio@ubient.net",
"homepage": "https://ubient.net",
"role": "Developer"
}
],
"require": {
"php": "^7.1",
"illuminate/http": "~5.5.0|~5.6.0|~5.7.0",
"illuminate/support": "~5.5.0|~5.6.0|~5.7.0"
},
"require-dev": {
"phpunit/phpunit": "^7.0",
"orchestra/testbench": "^3.7"
},
"autoload": {
"psr-4": {
"Ubient\\FlashMessage\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Ubient\\FlashMessage\\Tests\\": "tests"
}
},
"extra": {
"laravel": {
"providers": [
"Ubient\\FlashMessage\\FlashMessageServiceProvider"
]
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
Loading

0 comments on commit 1e75267

Please sign in to comment.