Skip to content

Commit 89e2ab4

Browse files
committed
It's still maintained
1 parent dcd5da7 commit 89e2ab4

5 files changed

Lines changed: 231 additions & 109 deletions

File tree

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Nanite
44
Requirements
55
------------
66

7-
- PHP 5.3+
7+
- PHP 8.3+
88

99
Example
1010
-------
@@ -47,15 +47,13 @@ Apache `mod_rewrite`
4747
RewriteCond %{REQUEST_FILENAME} !-d
4848
RewriteCond %{REQUEST_FILENAME} !-f
4949
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
50-
# or
51-
# RewriteRule ^(.*)$ index.php?url=/$1 [L,QSA]
52-
50+
5351
Lighttpd `mod_rewrite`
5452
----------------------
5553

5654
server.modules += ( "mod_rewrite" )
5755
url.rewrite-if-not-file += (
58-
"^/(.*)" => "/index.php?url=/$1"
56+
"^/(.*)" => "/index.php?/$1"
5957
)
6058

6159
License

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
"files": ["src/functions.php"]
1616
},
1717
"require": {
18-
"php": ">=5.3.0"
18+
"php": ">=8.3.0"
1919
}
20-
}
20+
}

example.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
require 'src/Nanite.php';
4+
require 'src/functions.php';
5+
6+
get('/', function () {
7+
?>
8+
<h1>Nanite Example</h1>
9+
<h2>Post</h2>
10+
<form action="<?= $_SERVER['PHP_SELF'] ?>?<?= baseUri('/test') ?>" method="post">
11+
<input type="text" name="name" />
12+
<button type="submit">Submit</button>
13+
</form>
14+
<h2>Put</h2>
15+
<form action="<?= $_SERVER['PHP_SELF'] ?>?<?= baseUri('/test') ?>" method="post">
16+
<input type="hidden" name="_method" value="PUT" />
17+
<input type="text" name="name" />
18+
<button type="submit">Submit</button>
19+
</form>
20+
<h2>Patch</h2>
21+
<form action="<?= $_SERVER['PHP_SELF'] ?>?<?= baseUri('/test') ?>" method="post">
22+
<input type="hidden" name="_method" value="PATCH" />
23+
<input type="text" name="name" />
24+
<button type="submit">Submit</button>
25+
</form>
26+
<h2>Delete</h2>
27+
<form action="<?= $_SERVER['PHP_SELF'] ?>?<?= baseUri('/123/delete') ?>" method="post">
28+
<input type="hidden" name="_method" value="DELETE" />
29+
<button type="submit">Delete</button>
30+
</form>
31+
<?php
32+
});
33+
34+
get('/test', function () {
35+
echo "Test page";
36+
});
37+
38+
post('/test', function () {
39+
$name = empty($_POST['name']) ? 'World' : $_POST['name'];
40+
echo "Hello, {$name}";
41+
});
42+
43+
put('/test', function () {
44+
echo 'Put: ' . $_POST['name'];
45+
});
46+
47+
patch('/test', function () {
48+
echo 'Patch: ' . $_POST['name'];
49+
});
50+
51+
delete('/([0-9]+)/delete', function ($id) {
52+
echo "Deleted: {$id}";
53+
});

0 commit comments

Comments
 (0)