Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/scrawler-labs/router
Browse files Browse the repository at this point in the history
  • Loading branch information
ipranjal committed Jun 6, 2022
2 parents e61aee8 + 649505d commit fc6370a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ getArticles, postUser, putResource
```
GETarticles, Postuser, PutResource
```
<br><br>
<br>

## 🏠 Website home page
Scrawler Router uses a special function name `allIndex()` and special controller name `Main`. So If you want to make a controller for your landing page `\` the controller will be defines as follows
Expand All @@ -160,7 +160,7 @@ class Main
}
}
```
<br><br>
<br>

## 🌟 Main Controller
Class name with `Main` signifies special meaning in Scrawler Router , if you wanna define pages route URL you can use main controler
Expand All @@ -186,7 +186,7 @@ class Main
}
}
```
<br><br>
<br>

## πŸ‘‰ Index function
Just like `Main` controller `allIndex(), getIndex(), postIndex()` etc signifies a special meaning , urls with only controller name and no function name will try to resolve into this function.
Expand All @@ -207,7 +207,7 @@ class Hello
}
}
```
<br><br>
<br>

## πŸ”„ Redirection
If you want to redirect a request you can return a Symphony redirect response
Expand All @@ -226,7 +226,8 @@ class Hello
// redirect to external urls
return new RedirectResponse('http://example.com/');

// Or alternatively you can set your arguments in flashback and redirect to internal URL
// Or alternatively you can set your arguments in flashbagk and redirect to internal URL
// Note you may use any flash manager to achieve this but as HttpFoundation is already a dependecy of Router here is a exmple with Symfony Session
$session = new Session();
$session->start();
$session->getFlashBag()->add('notice', 'Profile updated');
Expand All @@ -235,9 +236,8 @@ class Hello
}
}
```
<br></br>

Infact from Scrawler Router 3.1.0 you can directly return object of [\Symfony\Component\HttpFoundation\Response](https://symfony.com/doc/current/components/http_foundation.html#response)
Infact from Scrawler Router 3.1.0 you can directly return object of [\Symfony\Component\HttpFoundation\Response](https://symfony.com/doc/current/components/http_foundation.html#response) from your controller
<br><br>

## πŸ‘ Supporters
If you have reached here consider giving a star to help this project ❀️
Expand Down

0 comments on commit fc6370a

Please sign in to comment.