Download the PHP package viraj/hawkeye without Composer

On this page you can find all versions of the php package viraj/hawkeye. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package 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

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

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

Now generate the Hawkeye migration:

php artisan hawkeye:migration

It will generate the <timestamp>_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

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

A typical Hawkeye configuration file should look like as follows:

Base directory configuration

Setup the base directory in config/hawkeye.php where your files will be stored.

'hawkeye_base_path' => 'path/to/directory',

For e.g. if you want to have your files in public/images directory then,

'hawkeye_base_path' => 'images/',

Note: Don't forget the forward slash after images

or if, you want to store them outside public directory, let's suppose in storage/images, then give the path to directory

'hawkeye_base_path' => '../storage/images/',

Hawkeye will store the files in appropriate directory.

Image Resizing configuration

You can configure Hawkeye to resize uploaded images in various dimensions you require. It comes with some default image dimensions for resizing images according to industry standards, but you are free to configure according to your needs. If you need some different values, edit the values accordingly in config/hawkeye.php :

'images' => [
    'banner' => '1200x800',
    'thumbnail' => '300x200',
    'large' => '600x500',
],

If you want to stick with above configuration and also add some custom configuration for your app, you can do that as well. Just add the needed dimension and name for your configuration.

'images' => [
    'banner' => '1200x800',
    'thumbnail' => '300x200',
    'large' => '600x500',
    'your-configuration' => '800x600',
],

Upload Files using Hawkeye

upload.blade.php

FileController.php

Uploading and resizing files

In your controller, you can write

The above code will upload, resize (to all the image types specified in configuration) and give you a nested array of file names (md5 hashed names):

The above response has 2 parameters:

list - It has a list of all files that have been uploaded and resized.

separated - It has a segregated/separated list of all uploaded files and resized images as well, if any!

getList()

If you only want the list of all uploaded and resized files without the data about image type, you can use getList() method as follows:

The

Resizing for specific image types

Sometimes, you don't want to resize your images in all the types specified in configuration. Don't worry, Hawkeye has a provision for that as well. Specify the name of image types you want the uploaded images to be resized into in resize() method and Hawkeye will resize into those types only.

The above code will just resize your images in only 2 types - banner and large. The response will be:

generateFullImagePathFor()

This function returns the full image path for a particular file name (hashed) with extension.

Example 1 (Resized image - It has dimesnions appended to the name)

Example 2 (Original image - It has original name)

License

Hawkeye is free software distributed under the terms of the MIT license


All versions of hawkeye with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package viraj/hawkeye contains the following files

Loading the files please wait ....