2017 © Pedro Peláez
 

library filemanager

create log file

image

itsaninho/filemanager

create log file

  • Monday, February 5, 2018
  • by Sasha Fedorchuk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Filemanager

Filemanager package for Laravel, (*1)

Installation

To install, run the following in your project directory:, (*2)

``` bash $ composer require itsaninho/filemanager, (*3)


Then in `config/app.php` add the following to the `providers` array:

\Itsaninho\Filemanager\FilemanagerServiceProvider::class, 'Tymon\JWTAuth\Providers\JWTAuthServiceProvider',, (*4)


Also in config/app.php, add the Facade class to the aliases array:

'Filemanager' => \Divart\Filemanager\Facades\Filemanager::class, 'JWTAuth' => 'Tymon\JWTAuth\Facades\JWTAuth', (*5)


## Configuration To publish Filemanager's configuration file, run the following `vendor:publish` command:

php artisan vendor:publish --provider="Divart\Filemanager\FilemanagerServiceProvider" php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider", (*6)


Now for token encryption, I need to generate a secret key by running following line of code :

php artisan jwt:generate, (*7)


Now I will create middleware to check if the token is valid or not and also You can handle the exception if the token is expired.

php artisan make:middleware VerifyJWTToken, (*8)


Using this middleware, you can filter the request and validate the JWT token. Now open your VerifyJWTToken middleware and put below line of code. app/Http/Middleware/VerifyJWTToken.php pop-uptext

<?php, (*9)

namespace App\Http\Middleware;, (*10)

use Closure; use JWTAuth; use Tymon\JWTAuth\Exceptions\JWTException; use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;, (*11)

class VerifyJWTToken { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { try{ $user = JWTAuth::toUser($request->input('token')); }catch (JWTException $e) { if($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) { return response()->json(['token_expired'], $e->getStatusCode()); }else if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) { return response()->json(['token_invalid'], $e->getStatusCode()); }else{ return response()->json(['error'=>'Token is required']); } } return $next($request); } }, (*12)

The try block in handle method check if requested token is verified by JWTAuth or not if it is not verified then exception will be handled in catch block with their status.

Now register this middleware in your kernal to run during every HTTP request to your application.
app/Http/Kernel.php

protected $routeMiddleware = [ ... 'jwt.auth' => \App\Http\Middleware\VerifyJWTToken::class, ]; ```, (*13)

Usage

Add from ENV file:, (*14)

FILEMANAGER_LOCATION - File manager location

FILEMANAGER_LOCATION=filemanager, (*15)

Available routes, (*16)

To work with the file manager you need to login by POST method, send an email address and password to this route to authorize and receive a token, (*17)

http.youdomain.com/auth/login, (*18)

File Manager Routes, (*19)

All file manager paths have a prefix 'filemanager', (*20)

example:, (*21)

method GET http.youdomain.com/filemanager this method open filemanager and scan him, (*22)

method POST http.youdomain.com/filemanager this method accepts data for sorting items into a file manager, (*23)

method GET http.youdomain.com/filemanager/folder/{path to folder} this route open this selected folder, (*24)

method POST http.youdomain.com/filemanager/folder/{path to folder}/create this method create new folder in this directory Need to send data: 'name' where name is name folder, (*25)

method PUT http.youdomain.com/filemanager/folder/{path to folder}/update this method update(rename folder) selected folder in this directory Need to send data: 'name', 'newname' where 'name' is name selected folder and 'newname' that new name folder, (*26)

method DELETE http.youdomain.com/filemanager/folder/{path to folder}/delete this method delete selected folder in this directory Need to send data: 'name', where value is name selected folder, (*27)

method POST http.youdomain.com/filemanager/folder/{path to folder}/changelocation this method change location folder and the attachments in it are files Need to send data: 'from', 'to'. 'from' - address from which of the derivatives, 'to' - where to move, (*28)

method GET http.youdomain.com/filemanager/folder/{path to file}/file/{filename} this method send file data Need to send data: 'name', where value is name selected folder, (*29)

method POST http.youdomain.com/filemanager/folder/{path to file}/file/create Need to send: 'name' and 'data' where value name is name file and your expansion, 'data' is content file, (*30)

method PUT http.youdomain.com/filemanager/folder/{path to file}/file/update Need to send: 'name' and 'data' where value name is name file and your expansion, 'data' is content file, (*31)

method POST http.youdomain.com/filemanager/folder/{path to file}/file/upload this method upload file, (*32)

method DELETE http.youdomain.com/filemanager/folder/{path to file}/file/delete Need to send: 'name' and the file is deleted, (*33)

method POST http.youdomain.com/filemanager/folder/{path to folder}/file/changelocation this method change location file Need to send data: 'from', 'to'. 'from' - address from which of the derivatives, 'to' - where to move, (*34)

License

The MIT License (MIT). Please see License File for more information."# Filemanager" "# Filemanager", (*35)

The Versions

05/02 2018

dev-master

9999999-dev

create log file

  Sources   Download

MIT

The Requires

 

by Itsaninho

30/01 2018

1.0.0

1.0.0.0

create log file

  Sources   Download

MIT

The Requires

 

by Itsaninho