PHPackages                             viraj/hawkeye - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. viraj/hawkeye

AbandonedLibrary[File &amp; Storage](/categories/file-storage)

viraj/hawkeye
=============

A package for uploading files automatically in a nested md5 hash naming folder structure. A mini CDN for optimized file storage for Laravel.

v1.0.7(9y ago)75.5k↓73.3%1[1 issues](https://github.com/viraj-khatavkar/hawkeye/issues)MITPHPPHP &gt;=5.4.0

Since Mar 14Pushed 9y ago1 watchersCompare

[ Source](https://github.com/viraj-khatavkar/hawkeye)[ Packagist](https://packagist.org/packages/viraj/hawkeye)[ RSS](/packages/viraj-hawkeye/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (11)Used By (0)

Hawkeye
=======

[](#hawkeye)

A Laravel package for uploading files automatically in a nested md5 hash naming folder structure. A mini CDN for optimized file storage for Laravel.

Objective
---------

[](#objective)

Normally, we upload a file into a specific folder. In small applications, this is perfectly fine, but in large applications having about thousands of files in a single folder hampers performance. Hawkeye aims to solve this problem. Hawkeye retrieves the uploaded file, creates an unique id and hashes the id with md5. The hashed file is used to create the nested folder structure for the file.

```
md5 hash of uploaded file => c4ca4238a0b923820dcc509a6f75849b.jpg

```

The above hashed name will be used to create a directory as

```
c4c/a42/38a/0b9/238/20d/cc5/09a/6f7/584/c4ca4238a0b923820dcc509a6f75849b.jpg

```

Installation
------------

[](#installation)

In order to install Hawkeye, just add

```
"viraj/hawkeye": "dev-master"

```

to your composer.json. Then run `composer install` or `composer update`.

Then in your `config/app.php` add

```
'Viraj\Hawkeye\HawkeyeServiceProvider',

```

in the providers array and

```
'Hawkeye' 	=> 'Viraj\Hawkeye\HawkeyeFacade',

```

to the `aliases` array.

Create Migration
----------------

[](#create-migration)

Now generate the Hawkeye migration:

`php artisan hawkeye:migration`

It will generate the `_hawkeye_setup_tables.php` migration. You may now run it with the artisan migrate command:

`php artisan migrate`After the migration, one new table will be present:

`hawkeye` — stores file records and its meta data

Configuration
-------------

[](#configuration)

You need to publish the configuration for this package to further customize the storage path of files. Just use `php artisan vendor:publish` and a `hawkeye.php` file will be created in your `app/config` directory.

### Configuration file

[](#configuration-file)

A typical `Hawkeye` configuration file should look like as follows:

```
