Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
47cd93f
:fire: remove constructor
mychidarko May 9, 2022
a9cabbd
:fire: remove cors method
mychidarko May 9, 2022
795e927
:sparkles: added withHeader method
mychidarko May 9, 2022
076a277
:sparkles: added return this for status
mychidarko May 9, 2022
508c670
:sparkles: swapped out cookie methods
mychidarko May 9, 2022
d3c7026
:sparkles: added status code helper
mychidarko May 9, 2022
f46118f
:sparkles: added withFlash method
mychidarko May 9, 2022
39c8d6e
:sparkles: added base for restructure
mychidarko May 9, 2022
1100cf2
🏗️ create foundation for restructure
mychidarko May 9, 2022
94d902a
💥 update response
mychidarko May 14, 2022
37d523e
:sparkles: added functional mode cache
mychidarko May 14, 2022
5acf357
:memo: update readme
mychidarko May 14, 2022
f480f1c
:memo: update readme
mychidarko May 14, 2022
498a94e
:bookmark: update version
mychidarko May 14, 2022
83b0c59
🏗️ update internals for better usability
mychidarko May 14, 2022
05f08d3
:sparkles: add headers has method
mychidarko May 14, 2022
aead66a
:sparkles: add support for x-www-form-urlencoded data
mychidarko May 14, 2022
365e782
:memo: update readme
mychidarko May 14, 2022
b54add6
:memo: update readme
mychidarko May 14, 2022
bce6cda
🧱 standardadize functional mode
mychidarko May 15, 2022
bd51313
:sparkles: added has method
mychidarko May 16, 2022
429580d
:boom: remove 4th param on json
mychidarko May 16, 2022
69a3b5b
:memo: updated PHP doc
mychidarko May 16, 2022
d1de313
:sparkles: restructured redirect and noContent
mychidarko May 20, 2022
b5a9009
:memo: updated phpdoc
mychidarko May 29, 2022
6afa66e
:sparkles: update cookie unset types
mychidarko May 29, 2022
ea0d9b1
:memo: update readme
mychidarko May 29, 2022
16095b0
fix: switch page to internal output buffers
mychidarko Sep 6, 2022
57d5724
chore: update leaf anchor
mychidarko Sep 6, 2022
4e761f0
feat: add rawData method
mychidarko Sep 6, 2022
4fc9369
feat: add urlData method
mychidarko Sep 6, 2022
2ab3671
feat: add postData method
mychidarko Sep 6, 2022
934c532
feat: update request object
mychidarko Sep 6, 2022
6f0cf02
style: patch up errors
mychidarko Oct 2, 2022
76bd521
fix: make try static
mychidarko Oct 2, 2022
21cfbfe
fix: patch up errors with input()
mychidarko Oct 2, 2022
6e5e47f
fix: patch up status
mychidarko Oct 2, 2022
368624d
feat: temporarily save each response
mychidarko Oct 6, 2022
773cc8f
Fixed Content-Type json UTF-8
jeis4n Oct 7, 2022
080238a
Merge pull request #8 from jeis4n/patch-1
mychidarko Oct 8, 2022
edb8888
fix: falsy values not showing
mychidarko Oct 14, 2022
c986250
feat: add cookie array
mychidarko Oct 14, 2022
193648d
Merge branch 'v2' of https://github.com/leafsphp/http into v2
mychidarko Oct 14, 2022
82c0e4f
fix: patch up strpos error
mychidarko Oct 14, 2022
5768ef0
feat: add support for eien
mychidarko Oct 14, 2022
7318830
feat: added support for new eien functions
mychidarko Oct 16, 2022
593dc1b
feat: add support for request headers
mychidarko Oct 23, 2022
db6ea4e
fix: remove cookie restriction
mychidarko Dec 22, 2022
7eb83c4
fix: patch up null header issue
mychidarko Dec 22, 2022
2809c6e
fix: patch up dirty urlencoded data
mychidarko Dec 22, 2022
aecb289
Make Headers::get case insensitive
induwara16 Jan 12, 2023
47a8f58
Merge pull request #12 from induwara16/patch-1
mychidarko Jan 12, 2023
10ad20b
fix: add content headers for download
mychidarko Apr 20, 2023
6727270
chore: update gitignore
mychidarko Apr 20, 2023
77eebb3
chore: update composer.json
mychidarko Apr 20, 2023
bc80630
fix: isAjax header correction (#15)
kczx3 Apr 26, 2023
e971c95
feat: add request validation
mychidarko Jul 19, 2023
cc03c75
feat: added support for auth functions
mychidarko Jul 24, 2023
0373670
fix: patch up content_type issue
mychidarko Aug 12, 2023
a7db414
feat: return parsed data when validation succeeds
mychidarko Aug 12, 2023
36be8ac
feat: add option to return full data
mychidarko Aug 19, 2023
d54f6dc
fix: patch up deps versions
mychidarko Aug 24, 2023
5a04b4c
Added `store` and `storeAs` methods
ibnsultan Aug 6, 2024
6c5a221
Update composer.json
ibnsultan Aug 6, 2024
c14b208
Merge pull request #20 from ibnsultan/v2.x
ibnsultan Aug 8, 2024
0dc32fc
Prefixed file destination to the storage basePath
ibnsultan Aug 10, 2024
103d4bc
feat: switch to new leaf DI
mychidarko Aug 14, 2024
192092d
feat: update upload & fix request issues
mychidarko Aug 14, 2024
75743d6
fix: patch up redirect base url
mychidarko Aug 14, 2024
2be5cbb
feat: use new config API
mychidarko Aug 19, 2024
1882a7c
feat: restore uploadAs
mychidarko Aug 24, 2024
8f3b9d4
fix: temporary fix (will update later)
mychidarko Aug 24, 2024
c7753c1
feat: add middleware data
mychidarko Sep 16, 2024
b413eb9
feat: add response->die
mychidarko Sep 16, 2024
9a02b3c
feat: add query and getOrDefault methods
mychidarko Sep 16, 2024
c506a57
add custom responses (fix #21) (#22)
Rasalas Sep 27, 2024
c7397aa
feat: add response::next method
mychidarko Oct 1, 2024
7be4caa
chore: clean up
mychidarko Oct 1, 2024
0e25aa9
fix: prevent unique name generation when rename is true
ibnsultan Oct 12, 2024
fe50aef
fix: prevent unique name generation when rename is true
ibnsultan Oct 12, 2024
aa42931
chore: update readme
mychidarko Nov 4, 2024
82103fa
feat: add support for named routes on redirect
mychidarko Nov 4, 2024
e9149bf
feat: add internal validator instance
mychidarko Nov 4, 2024
78dca3c
chore: add fs constraint
mychidarko Nov 6, 2024
32e152e
fix: patch up withFlash function
mychidarko Nov 8, 2024
af44977
fix: patch up validation returnFullData
mychidarko Nov 8, 2024
e5bb44c
feat: add redirect exit
mychidarko Nov 8, 2024
af0dba3
feat: update version constraints
mychidarko Nov 8, 2024
c0553e5
fix: patch up empty form error (#24)
mychidarko Nov 10, 2024
38edd9a
Update Request.php fix explicit nullable php 8.4 (#27)
joanhey Nov 27, 2024
75ebfa2
fix: patch up external url redirects
mychidarko Dec 4, 2024
f311f53
feat: add custom method
mychidarko Dec 5, 2024
8713b4d
fix: normalize request path methods
mychidarko Dec 6, 2024
7a8500a
support router args if using router with name (#28)
phederal Dec 6, 2024
e276d90
fix: Compatibility with the latest `Leaf\FS` package
ibnsultan Dec 23, 2024
b566290
Fixed issue: 'Fatal error with unofficial http status codes' (#34)
Laivee Jan 16, 2025
0535173
feat: add support for method overrides
mychidarko Jan 17, 2025
9234617
chore: clean up
mychidarko Jan 17, 2025
b757da8
fix: patch up _method check
mychidarko Jan 17, 2025
1f722e3
chore: clean up
mychidarko Jan 17, 2025
6e25044
feat: add response::view function to render configured views
mychidarko Jan 28, 2025
476a4ae
fix: getUserAgent() doesn't handle the header properly because of fur…
ruiwashere Jan 29, 2025
8bd945f
feat: add render function
mychidarko Jan 29, 2025
d05393a
fix: patch up response::view()
mychidarko Jan 29, 2025
d9eaa21
feat: add flash messaging to request
mychidarko Feb 14, 2025
e3b0465
feat: add inertia response
mychidarko Feb 24, 2025
66ea0dd
feat: add fallback for server QUERY_STRING
mychidarko Feb 24, 2025
e31686d
feat: add getFullUrl method
mychidarko Feb 24, 2025
558bf53
feat: update deps
mychidarko Feb 28, 2025
61e0f83
feat: add support for multiple input files
mychidarko Mar 26, 2025
4ac870c
feat: add support for ip geolocation
mychidarko Jun 25, 2025
c41ef17
feat: switch api call to curl
mychidarko Jul 15, 2025
fca29b5
fix: patch up ip pipeline
mychidarko Aug 18, 2025
2ff6d21
feat: add callable defaults + content type helper
mychidarko Dec 8, 2025
f01dcfd
feat: add support for function getters
mychidarko Dec 9, 2025
7e6a2f3
fix: patch up params error
mychidarko Dec 13, 2025
85bec78
fix: patch up getting callables
mychidarko Jan 15, 2026
53f7d26
chore: setup v5 base
mychidarko Jul 26, 2026
aac33c5
test: add http tests
mychidarko Jul 28, 2026
698b497
chore: add minimum PHP version 8.2
mychidarko Jul 30, 2026
3e2fcad
feat: add request.object() as object for of body()
mychidarko Jul 30, 2026
13f7540
fix: add codes on view/render + add resumable support on download()
mychidarko Jul 30, 2026
cd22c52
test: update tests to include all features
mychidarko Jul 30, 2026
04de57b
feat: add support for content security headers
mychidarko Aug 6, 2026
a820865
feat: add support for content security headers
mychidarko Aug 6, 2026
7a10da5
fix: patch up cookies and flash display
mychidarko Aug 6, 2026
166a6cc
fix: patch up withoutCookie()
mychidarko Aug 6, 2026
caa5552
chore: update deps
mychidarko Aug 12, 2026
f31b4ee
fix: add engine resolver to fix missing view engine error
mychidarko Aug 23, 2026
9cf97b6
fix: remove curl close
mychidarko Sep 13, 2026
2a1b8e8
feat: add support for code on inertia()
mychidarko Sep 17, 2026
1e6fd74
ci: add PHP 8.5 to the test matrix (#40)
mychidarko Nov 9, 2026
4602c01
fix: include Leaf\FS\File errors in Request::errors()
Nov 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint code

on: ["push","pull_request"]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: json, zip, curl
tools: composer:v2
coverage: none

- name: Install PHP dependencies
run: composer update --no-interaction --no-progress

- name: Run Linter
run: composer run lint -- --check
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Run Tests

on: ["push","pull_request"]

jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ["macos-latest","ubuntu-latest","windows-latest"]
php: ["8.5","8.4","8.3","8.2"]

name: PHP ${{ matrix.php }} - ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, zip, curl
tools: composer:v2
coverage: xdebug

- name: Install PHP dependencies
run: composer update --no-interaction --no-progress

- name: Run Tests
run: composer run test -- --flags=coverage
29 changes: 25 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
test
Experimental
vendor
composer.lock
# Global
.phpunit*
.composer
composer.lock
package-lock.json
.phpunit.result.cache
.php-cs-fixer.cache
vendor/
test/

# OS Generated
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
*.swp

# phpstorm
.idea/*

# Alchemy
.alchemy

# Alchemy-generated (kept for IDE support, never committed)
phpunit.xml
69 changes: 58 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,74 @@
<!-- markdownlint-disable no-inline-html -->
<p align="center">
<br><br>
<img src="https://leafphp.netlify.app/assets/img/leaf3-logo.png" height="100"/>
<h1 align="center">Leaf HTTP Module</h1>
<br><br>
<img src="https://leafphp.dev/logo-circle.png" height="100"/>
<br>
</p>

# Leaf PHP
<h1 align="center">Leaf Http</h1>

[![Latest Stable Version](https://poser.pugx.org/leafs/http/v/stable)](https://packagist.org/packages/leafs/http)
[![Total Downloads](https://poser.pugx.org/leafs/http/downloads)](https://packagist.org/packages/leafs/http)
[![License](https://poser.pugx.org/leafs/http/license)](https://packagist.org/packages/leafs/http)
<p align="center">
<a href="https://packagist.org/packages/leafs/http"
><img
src="https://poser.pugx.org/leafs/http/v/stable"
alt="Latest Stable Version"
/></a>
<a href="https://packagist.org/packages/leafs/http"
><img
src="https://poser.pugx.org/leafs/http/downloads"
alt="Total Downloads"
/></a>
<a href="https://packagist.org/packages/leafs/http"
><img
src="https://poser.pugx.org/leafs/http/license"
alt="License"
/></a>
</p>
<br />
<br />

Leaf's core http functionality packaged as a serve-yourself module. Although seperated from Leaf core, it is still part of the default initial installation and doesn't need to be installed manually (unless you want a particular version).
Leaf's HTTP abstraction is a developer friendly way to interact with HTTP requests and responses. If you are using it within a Leaf app, there's no need to install anything as it comes pre-installed with Leaf. If you are using it outside of Leaf, you can install it via composer.

## Installation

You can easily install Leaf using [Composer](https://getcomposer.org/).
You can easily install Leaf using the [Leaf CLI](https://cli.leafphp.dev)

```sh
leaf install http
```

[Composer](https://getcomposer.org/).

```bash
composer require leafs/http
```

## View Leaf's docs [here](https://leafphp.netlify.app/#/)
## Basic Usage

You can find the full documentation on how to use Leaf Http [here](https://leafphp.dev/docs/http/request).

## Stay In Touch

- [Twitter](https://twitter.com/leafphp)
- [Join the forum](https://github.com/leafsphp/leaf/discussions/37)
- [Chat on discord](https://discord.com/invite/Pkrm9NJPE3)

## Learning Leaf PHP

- Leaf has a very easy to understand [documentation](https://leafphp.dev) which contains information on all operations in Leaf.
- You can also check out our [youtube channel](https://www.youtube.com/channel/UCllE-GsYy10RkxBUK0HIffw) which has video tutorials on different topics
- You can also learn from [codelabs](https://leafphp.dev/codelabs/) and contribute as well.

## Contributing

We are glad to have you. All contributions are welcome! To get started, familiarize yourself with our [contribution guide](https://leafphp.dev/community/contributing.html) and you'll be ready to make your first pull request 🚀.

To report a security vulnerability, you can reach out to [@mychidarko](https://twitter.com/mychidarko) or [@leafphp](https://twitter.com/leafphp) on twitter. We will coordinate the fix and eventually commit the solution in this project.

## Sponsoring Leaf

We are committed to keeping Leaf open-source and free, but maintaining and developing new features now requires significant time and resources. As the project has grown, so have the costs, which have been mostly covered by the team. To sustain and grow Leaf, we need your help to support full-time maintainers.

You can sponsor Leaf and any of our packages on [open collective](https://opencollective.com/leaf) or check the [contribution page](https://leafphp.dev/support/) for a list of ways to contribute.

Built with ❤ by [**Mychi Darko**](https://mychi.netlify.app)
And to all our [existing cash/code contributors](https://leafphp.dev#sponsors), we love you all ❤️
60 changes: 60 additions & 0 deletions alchemy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
app:
- src

tests:
engine: pest
parallel: false
paths:
- tests
files:
- '*.test.php'
coverage:
processUncoveredFiles: true

lint:
preset: PSR12
rules:
single_quote: true
phpdoc_scalar: true
no_unused_imports: true
unary_operator_spaces: true
binary_operator_spaces: true
phpdoc_var_without_name: true
trailing_comma_in_multiline: true
phpdoc_single_line_var_spacing: true
single_trait_insert_per_statement: true
not_operator_with_successor_space: false
array_syntax:
syntax: short
ordered_imports:
sort_algorithm: alpha
method_argument_space:
on_multiline: ensure_fully_multiline
keep_multiple_spaces_after_comma: true
blank_line_before_statement:
statements:
- try
- break
- throw
- return
- declare
- continue

actions:
run:
- lint
- tests
os:
- macos-latest
- ubuntu-latest
- windows-latest
php:
extensions: json, zip, curl
versions: # library supports ^7.4|^8.0, but pest 3 needs 8.2+
- '8.5'
- '8.4'
- '8.3'
- '8.2'
events:
- push
- pull_request
31 changes: 25 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "leafs/http",
"description": "Leaf PHP HTTP module.",
"description": "Http abstraction for Leaf PHP",
"keywords": [
"http",
"request",
Expand All @@ -10,7 +10,7 @@
"php",
"framework"
],
"homepage": "https://leafphp.netlify.app/#/",
"homepage": "https://leafphp.dev/modules/http/v/2/request.html",
"type": "library",
"license": "MIT",
"authors": [
Expand All @@ -26,12 +26,31 @@
"Leaf\\Http\\": "src"
},
"files": [
"src/functions.php"
]
"src/functions.php"
]
},
"minimum-stability": "dev",
"prefer-stable": true,
"prefer-stable": true,
"require": {
"leafs/anchor": "^1.0"
"php": "^8.2",
"leafs/anchor": "^5.0",
"leafs/form": "^5.0",
"leafs/fs": "^5.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "*",
"pestphp/pest": "*",
"leafs/alchemy": "^5.0"
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"scripts": {
"test": "./vendor/bin/alchemy test",
"lint": "./vendor/bin/alchemy lint",
"fmt": "./vendor/bin/alchemy fmt",
"ci": "./vendor/bin/alchemy ci"
}
}
Loading
Loading