Skip to content

Commit

Permalink
update readme and document
Browse files Browse the repository at this point in the history
  • Loading branch information
streamtw committed Aug 3, 2016
1 parent 9715b09 commit 8ffe49a
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 45 deletions.
51 changes: 6 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,63 +21,24 @@ PR is welcome!
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)

## Upgrade guide
* `composer update unisharp/laravel-filemanager`
* `php artisan vendor:publish --tag=lfm_view --force`
* `php artisan vendor:publish --tag=lfm_config --force` (IMPORTANT: please backup your own `config/lfm.php` first)
1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md)
1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md)

## Screenshots
* Independent usage example :

![Independent usage example](http://unisharp.github.io/images/lfm01.png)
![Independent usage example](https://raw.githubusercontent.com/UniSharp/laravel-filemanager/gh_pages/images/lfm01.png)

* List view :

![FileManager screenshot 1](http://unisharp.com/img/filemanager1.png)
![FileManager screenshot 1](https://raw.githubusercontent.com/UniSharp/laravel-filemanager/gh_pages/images/lfm02.png)

* Grid view :

![FileManager screenshot 2](http://unisharp.com/img/filemanager2.png)

## Events

To use events you can add a listener to listen to the events

Snippet for `EventServiceProvider`
```php
protected $listen = [
ImageWasUploaded::class => [
UploadListener::class,
],
];
```

The `UploadListener` will look like:
```php
class UploadListener
{
public function handle($event)
{
$method = 'on'.class_basename($event);
if (method_exists($this, $method)) {
call_user_func([$this, $method], $event);
}
}

public function onImageWasUploaded(ImageWasUploaded $event)
{
$path = $event->path();
//your code, for example resizing and cropping
}
}
```

List of events:
* Unisharp\Laravelfilemanager\Events\ImageWasUploaded
![FileManager screenshot 2](https://raw.githubusercontent.com/UniSharp/laravel-filemanager/gh_pages/images/lfm03.png)

## Credits
* All contibutors from GitHub. (issues / PR)
* [All contibutors](https://github.com/UniSharp/laravel-filemanager/graphs/contributors) from GitHub. (issues / PR)
* Special thanks to
* [@taswler](https://github.com/tsawler) the original author.
* [@olivervogel](https://github.com/olivervogel) for the awesome [image library](https://github.com/Intervention/image)
Expand Down
2 changes: 2 additions & 0 deletions doc/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md)
1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md)

## Config

Expand Down
2 changes: 2 additions & 0 deletions doc/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md)
1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md)

## Customization

Expand Down
44 changes: 44 additions & 0 deletions doc/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## Documents

1. [Installation](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/installation.md)
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md)
1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md)

## List of events
* Unisharp\Laravelfilemanager\Events\ImageWasUploaded

## How to use

To use events you can add a listener to listen to the events

Snippet for `EventServiceProvider`
```php
protected $listen = [
ImageWasUploaded::class => [
UploadListener::class,
],
];
```

The `UploadListener` will look like:
```php
class UploadListener
{
public function handle($event)
{
$method = 'on'.class_basename($event);
if (method_exists($this, $method)) {
call_user_func([$this, $method], $event);
}
}

public function onImageWasUploaded(ImageWasUploaded $event)
{
$path = $event->path();
//your code, for example resizing and cropping
}
}
```
2 changes: 2 additions & 0 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md)
1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md)

## Requirements

Expand Down
2 changes: 2 additions & 0 deletions doc/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md)
1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md)

## WYSIWYG Editor Integration:
### Option 1: CKEditor
Expand Down
14 changes: 14 additions & 0 deletions doc/upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Documents

1. [Installation](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/installation.md)
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md)
1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md)

## Upgrade guide
* `composer update unisharp/laravel-filemanager`
* `php artisan vendor:publish --tag=lfm_view --force`
* `php artisan vendor:publish --tag=lfm_config --force` (IMPORTANT: please backup your own `config/lfm.php` first)

0 comments on commit 8ffe49a

Please sign in to comment.