Download the PHP package tamedevelopers/file without Composer
On this page you can find all versions of the php package tamedevelopers/file. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download tamedevelopers/file
More information about tamedevelopers/file
Files in tamedevelopers/file
Download tamedevelopers/file
More information about tamedevelopers/file
Files in tamedevelopers/file
Please rate this library. Is it a good library?
Informations about the package file
File Upload
Documentation
- Requirements
- Installation
- Instantiate
- Amazon Aws S3
- Global Config
- INPUT HTML STRUCTURE
- Response Data
- Get Message
- Get Status
- Get Class
- First
- Get
- Form
- Unlink
- Usage
- Name
- Driver
- BaseDir
- Generate
- Folder
- Filter
- Structure
- Size
- Limit
- Mime
- Width
- Height
- Validate
- Save
- Resize
- WaterMark
- Compress
- Get External Image Size
- Get Uploaded Image Size
- Get Mime Type
- Not Empty
- Is Empty
- Has Error
- Is Completed
- Mime Types
- Useful links
Requirements
>= php 8.0+
Installation
Prior to installing support package
get the Composer dependency manager for PHP because it'll simplify installation.
Instantiate
Step 1 — Composer Instantiate class using
:
-
Example 2
- or --
Helpers Function
Amazon Aws S3
- To use s3 first require
composer require aws/aws-sdk-php
- By default Aws load entire SDK we won't be needing
- Copy the below code into your root
composer.json
and then runcomposer update
in terminal.
- Copy the below code into your root
Global Config
- Configure The Global Config, so you don't have to always include default settings
- Define as
named argument
- Define as
Key | Types | Description |
---|---|---|
message | Assoc array |
Create all error messages |
config | Assoc array |
Create all needed config data |
class | Assoc array |
Create error and success class |
- or -- using file class method
Global Config
INPUT HTML STRUCTURE
- or --
For Multiple Data
Response Data
- How to retrieve data
Get Message
- This will return error message
Get Status
- This will return error status code
Get Class
- This will only return msg, if there's an error or success
First
-
This will get the first uploaded data
- [optional] You can pass the mode as string
name
|path
|url
- [optional] You can pass the mode as string
or
Get
-
This will get all uploaded data
- Returns an index array of all uploaded data,
[name, path, url]
- [optional] You can pass the mode as string
name
|path
|url
- Returns an index array of all uploaded data,
or
Form
- Return form request data
- This will return
validator package
object Validator
- This will return
Unlink
- Accepts two param as string. This method uses the base path automatically.
- [mandatory]
$fileToUnlink
Path to file, you want to unlink. - [optional]
$checkFile
. This will check if$fileToUnlink
is not same, before.
- [mandatory]
Usage
Name
- Takes one param
string
as input name- Static method by default
Driver
- More drivers are to be added in the future
- By default driver is set to
local
- By default driver is set to
Key | Description |
---|---|
s3 | Amazon s3 driver. The package loaded [Ec2 and CloudWatch] needed by s3 |
local | Local host server driver. |
using driver if project is not in any Frameworks
BaseDir
- Takes one param
string
as base directory name- This will override the global configuration settings (Domain and Server Path will be set)
Generate
- Takes one param
bool
Folder
- Takes one param
string
asfolder_path
to save file
Filter
- Takes index or closed array index
- Remove
error status code
you do not want to validate - You cannot remove Error
200
- Remove
Status Code | Description |
---|---|
401 | Select file to upload |
402 | File upload is greater than allowed size of |
403 | Maximum file upload exceeded. Limit is |
404 | Uploaded file format not allowed. Allowed formats |
405 | Image dimension allowed is |
200 | File uploaded successfully |
or
Structure
- Takes one param
string
asstructure type
- Best used for
Media\|Blog\|Newsletter
Websites.
- Best used for
Key | Description |
---|---|
default | Files will be uploaded in defaut folder path |
year | Files will be uploaded in default/year path: folder/yyyy |
month | Files will be uploaded in default/year path: folder/yyyy/mm |
day | Files will be uploaded in default/year path: folder/yyyy/mm/dd |
- Default
- Year
- Month
- Day
- Month
- Year
Size
-
Takes one param
string
|int
- size in
int
|kb
|mb
|gb
- size in
or
Limit
- Takes one param
string
|int
- Default limit is set to
1
upload
- Default limit is set to
Mime
- Takes one param
string
as mime type- Goto
Mime Types
to see list
- Goto
Width
- Takes two param
string
|int
andbool
- 1st param is
string
|int
. width size - 2nd param is
bool
. This allow to check if size should be === or >= size of uploaded image. Default istrue
- 1st param is
Height
- Same as
width
method
Validate
- [optional] Method can be use, to return error message.
- Takes an [optional] param as a
callable\|closure
function.
- Takes an [optional] param as a
Save
-
Takes an [optional] param as a
callable\|closure
function.- Calling this [method] will automatically save the data.
or
Resize
- Takes two param as
size
int
width and height- Returns an instance of self
WaterMark
- Takes three param
watermarkSource
|position
|padding
- [mandatory] $watermarkSource
- Returns an instance of self
- Padding is applied evenly on all position apart from
center
Position key | Description |
---|---|
bottom-right | Default is bottom-right |
bottom-left | apply watermart to possition bottom-left |
top-right | apply watermart to possition top-right |
top-left | apply watermart to possition top-left |
center | apply watermart to possition center |
Compress
- Returns an instance of self
Get External Image Size
- Takes one param as
string
- Return an
array
|null
- Return an
Get Uploaded Image Size
- Takes one param as
string
- Return an
array
|null
- Return an
Get Mime Type
- Takes one param as
string
- Return
string
|bool
.false
on error.
- Return
Not Empty
- Takes one param as
string
. Input file name- Return bool
true
|false
- Return bool
Is Empty
- Same as not empty
Has Error
- Returns true or false. Check if there's an error in the upload
Is Completed
- Returns true or false. Check if upload has been completed
Mime Types
Key | Description |
---|---|
video | .mp4\|.mpeg\|.mov\|.avi\|.wmv |
audio | .mp3\|.wav |
file | .docx\|.doc\|.pdf\|.txt |
image | .jpg\|.jpeg\|.png\|.gif |
zip | .zip\|.rar |
.pdf |
|
xls | .xlsx\|.xls |
doc | .docx\|.doc\|.txt |
general_image | .jpg\|.jpeg\|.png\|.gif\|.webp\|.ico |
general_media | .mp3\|.wav\|.mp4\|.mpeg\|.mov\|.avi\|.wmv |
general_file | .docx\|.doc\|.pdf\|.txt\|.zip\|.rar\|.xlsx\|.xls |
Useful Links
- @author Fredrick Peterson (Tame Developers)
- If you love this PHP Library, you can Buy Tame Developers a coffee
All versions of file with dependencies
PHP Build Version
Package Version
The package tamedevelopers/file contains the following files
Loading the files please wait ....