Releases: leafsphp/http
Releases · leafsphp/http
v2.4.0
-
store
Method:- Purpose: This method stores a file from the request to a specified directory.
- Parameters:
string $key
: The name of the file input in the request.string $destination
: The directory where the file should be stored.array $configs
: Optional configurations such asmax_file_size
,file_type
, andextensions
.
- Returns: An object containing
status
,path
, anderror
message. - Benefit: Allows for validating file extensions and size limits, providing more granular control over file uploads.
# without options
request::store('file', '/uploads/directory')
# with options
request::store('file', '/uploads/directory', [
'extensions' => 'extensions' => ['jpg', 'jpeg', 'png', 'gif']
]
// output: FsInstance::$uploadInfo;
-
storeAs
Method:- Purpose: This method stores a file from the request with a specific name.
- Parameters:
string $key
: The name of the file input in the request.string $destination
: The directory where the file should be stored.string $filename
: The name to give the stored file.array $configs
: Optional configurations such asmax_file_size
,file_type
, andextensions
.
- Returns: An object containing
status
,path
, anderror
message. - Benefit: Provides the ability to rename files upon upload, in addition to validating extensions and size limits.
# without options
request::storeAs('file', '/uploads/directory', 'myNewName')
# with options
request::storeAs('file', '/uploads/directory', 'myNewName', [
'file_type' => 'image',
'max_file_size' => 10
]
// output: FsInstance::$uploadInfo;
🌨️ Snow Man
v2.3.0 - 24 Aug 2023
Added
- Added
request()->validate()
method - Added
request()->user()
method - Added
request()->errors()
method
Fixed
- Patched up
CONTENT-TYPE
header bug (#17)
🌤️ Sun Man '3'
v2.2.3 - 20 Apr 2023
Fixed
- Updated
Response::download
method with new headers
🌤️ Sun Man '2'
🌤️ Sun Man '1'
v2.2.1 - 22 Dec 2022
Fixed
- Fixed cookie requirement
🌤️ Sun Man
v2.2.0 - 23 Oct 2022
Added
- Added support for Eien
- Add support for request headers
Fixed
- Patch up HTTP status
- Fixed Content-Type json UTF-8
- Fix falsy values not showing
- Fix patch up strpos error
Changed
- Add cookie array
🌧️ Rain Man '1'
v2.1.1 - 2 October 2022
Added
- Added support for other request types
- Added support for whole string request bodies
Fixed
- Fixed
input
returning a string for non-json requests
🌧️ Rain Man
Weather man 🌤
v2.0 - 29 May 2022
Added
- Added method chaining (1100cf2)
- Added xml method to response (39bc5ff)
- Added
withHeader
method to response (795e927) - Added status code helper (d3c7026)
- Added
withCookie
method on response (508c670) - Added
withFlash
method on response (f46118f) - Added
has
method onHeaders
(bd51313) - Added response
noContent
(d1de313)
Fixed
Changed
- Rewrote base of response (1100cf2)
- Updated functional mode base (37d523e)
- Updated internals (83b0c59)
- Standardized functional mode (bce6cda)
- Updated code labels (69a3b5b)
- Updated
json
method onResponse
(429580d) - Updated response
redirect
(d1de313) - Updated cookie types (6afa66e)
Removed
v1.2.1
Added
- Added strict types
- Added content XML method
- Added download method on response
- Added plain response type
Fixed
- Fixed PHP 8 type bug on headers
- Refactored the entire codebase
- Fixed HTTP code bug
Changed
- Updated minimum stability
- Switched to camel case variables