Hi there! A friend and I recently tried the Lumen framework and we have encountered some problems.
Basically we when we make a GET/POST petition for example through a simple form with action="contact" the resultant URL looks something like this
http://localhost/public/contact?name=John&email=someEmailATemail.com
and it should be something like
http://localhost/public/contact/John/someEmailatemail.com
so when we tried to route it like this
$app->post('contact/{name}/{email}', 'ContactController@sendEmail');
We get an 404 error bacause its doesn't match it, even if we try something like this:
$app->post('contact?name={name}&email={email}', 'ContactController@sendEmail');
We get the same 404 error.
We are using xampp over windows, but we also tried Homestead and vagrant and we got the same problem.
Mod_rewrite is installed and working and I have my .htaccess file under the public folder with the default content:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
If I try to route any get petition like:
$app->get('contact/{name}/{email}', 'ContactController@sendEmail');
and type on the browser adressbar
http://localhost/public/contact/John/someEmailATemail.com
it works perfectly.
Thank you all for the time and help!