# Versioing in slim 3

**URL:** <https://discourse.slimframework.com/t/versioing-in-slim-3/1139>\
**Category:** Questions\
**Created:** [February 12, 2017, 4:57am UTC](https://discourse.slimframework.com/t/versioing-in-slim-3/1139 "2017-02-12T04:57:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashickur-noor](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/ashickur-noor/32/189_2.png) [@ashickur-noor](https://discourse.slimframework.com/u/ashickur-noor)\
**Post date:** [February 12, 2017, 4:57am UTC](https://discourse.slimframework.com/t/versioing-in-slim-3/1139/1 "2017-02-12T04:57:22Z")

</div>

I am very much naive in slim. Currently I am using

> $app-\>get(‘/verification’, function ($request, $response, $args) { });

pattern for routing. So my end point can be accessed by

> [api.domain.com/verification](http://api.domain.com/verification) .

Now I want to access my end point like

> [api.domain.com/spn/v1/verification](http://api.domain.com/spn/v1/verification)

But I don’t know how to do it. Can any one help?

---

<div class="post-metadata">

**Author:** ![akrabat](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/akrabat/32/9_2.png) [@akrabat](https://discourse.slimframework.com/u/akrabat)\
**Post date:** [February 12, 2017, 8:04am UTC](https://discourse.slimframework.com/t/versioing-in-slim-3/1139/2 "2017-02-12T08:04:30Z")

</div>

Put your routes inside a group:

```auto
$app->group('/v1', function () use ($app) {
    $app->get('/verification', function ($request, $response, $args) { });
}

```

---

<div class="post-metadata">

**Author:** ![ashickur-noor](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/ashickur-noor/32/189_2.png) [@ashickur-noor](https://discourse.slimframework.com/u/ashickur-noor)\
**Post date:** [February 13, 2017, 4:52am UTC](https://discourse.slimframework.com/t/versioing-in-slim-3/1139/3 "2017-02-13T04:52:45Z")

</div>

Here is the code

> ```
> $app->group('/v1', function () (use $app) {
> $app->get('/allmoffices', function ($request,$response,$args) {
> $ResponseSuccessArray['status']="true";
> $ResponseSuccessArray['type']="meffice";
> $ResponseSuccessArray['id']="2";
> $ResponseSuccessArray['attributes']=$DescArray;	
> $returnArray['data']=$ResponseSuccessArray;
> return $response->withJson($returnArray,201);
> });
> });
> 
> ```

I am getting this error.

> Parse error: syntax error, unexpected ‘(’, expecting ‘{’ in /Users/sharif/Sites/binameer/api/app/routes/allstatics.php on line 26

I think I am doing wrong some where or I couldn’t get it right. If you can give me a example link, it will be helpful.

---

<div class="post-metadata">

**Author:** ![akrabat](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/akrabat/32/9_2.png) [@akrabat](https://discourse.slimframework.com/u/akrabat)\
**Post date:** [February 13, 2017, 7:08am UTC](https://discourse.slimframework.com/t/versioing-in-slim-3/1139/4 "2017-02-13T07:08:04Z")

</div>

That’s the thing with off-the-cuff replies, you need to check the syntax of any given code and ensure that it’s valid PHP.

Check the syntax for `use` in [http://php.net/manual/en/functions.anonymous.php](http://php.net/manual/en/functions.anonymous.php) and you’ll see that it’s: `use ($var)`.
