Skip to content

Commit

Permalink
Preparing for release
Browse files Browse the repository at this point in the history
  • Loading branch information
gregoriohc committed Sep 3, 2016
1 parent 9af1425 commit 5116ca6
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 25 deletions.
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 this package will be documented in this file

## 1.0.0 - 2016-09-03

- 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**!
22 changes: 0 additions & 22 deletions LICENSE

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The MIT License (MIT)

Copyright (c) Gregorio Hernández Caso <gregoriohc@gmail.com>

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
91 changes: 88 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,92 @@
# Preview [WIP]
# Preview

**Warning: This package is in development!**
[![Latest Version on Packagist](https://img.shields.io/packagist/v/gregoriohc/laravel-preview.svg?style=flat-square)](https://packagist.org/packages/gregoriohc/laravel-preview)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/gregoriohc/laravel-preview/master.svg?style=flat-square)](https://travis-ci.org/gregoriohc/laravel-preview)
[![StyleCI](https://styleci.io/repos/65543339/shield)](https://styleci.io/repos/65543339)
[![Quality Score](https://img.shields.io/scrutinizer/g/gregoriohc/laravel-preview.svg?style=flat-square)](https://scrutinizer-ci.com/g/gregoriohc/laravel-preview)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/gregoriohc/laravel-preview/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/gregoriohc/laravel-preview/?branch=master)
[![Total Downloads](https://img.shields.io/packagist/dt/gregoriohc/laravel-preview.svg?style=flat-square)](https://packagist.org/packages/gregoriohc/laravel-preview)

**WARNING: USE THIS PACKAGE ONLY IN LOCAL/DEBUG MODE! ENABLING THIS PACKAGE IN PRODUCTION ENVIRONMENTS CAN REPRESENT A BIG SECURITY ISSUE!**

View preview package for Laravel

[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/gregoriohc/preview/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/gregoriohc/preview/?branch=master)
## Contents

- [Installation](#installation)
- [Usage](#usage)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

## Installation

You can install the package via composer:

``` bash
composer require gregoriohc/laravel-preview
```

You must install the service provider:

```php
// config/app.php
'providers' => [
...
Gregoriohc\Preview\PreviewServiceProvider::class,
],
```

## Usage

Now, if you are in local environment with debug mode enabled, you can access the preview route.

The preview route path has the following structure: `/_preview/{view}?{params}`

The `{view}` can be any app or package view, using the dot and namespace notation of Laravel (ex.: welcome, errors.503, mypackage::myview)

For example, if you want to preview the Laravel default welcome page, you can go to: `/_preview/welcome`

The optional `{params}` can be a list of parameters that will be converted to variables and passed to the view. The key of the parameter will be the variable name, and the value will be transformed depending on its format. The possible formats are the following:

- Object from json: If you pass a json string, it will be automatically converted to an object. For example: `user={"name": "John Doe", "email": "johndoe@example.com"}`
- Model object: To load a model object, just pass (separated by `::`) the model class (with full namespace) and the object ID you are looking for. For example: `user=App\User::1`.
- Class method call: To call a class method, just pass (separated by `::`) the class (with full namespace), the method, and a list of params. For example: `appname=Config::get::app.name` or `something=MyClass::myMethod::param_1::param_2::param_3`. If the method is static, it will called statically, if not, a class object will be instantiated and the method will be called.
- On any other case, the value will be passed without changes

More examples:

- `/_preview/emails.user.welcome?user=App\User::1`
- `/_preview/admin.user.show?user=App\User::1`
- `/_preview/mypackage::my.fantastic.view?something=Cache::get::something&anotherthing=textcontent&somenumber=123`

## Changelog

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

## Testing

``` bash
$ composer test
```

## Security

If you discover any security related issues, please email gregoriohc@gmail.com instead of using the issue tracker.

## Contributing

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

## Credits

- [Gregorio Hernández Caso](https://github.com/gregoriohc)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"Gregoriohc\\Preview\\Tests\\": "tests"
}
},
"scripts": {
"test": "vendor/bin/phpunit"
},
"minimum-stability": "dev",
"prefer-stable": true
}

0 comments on commit 5116ca6

Please sign in to comment.