PHP - how to create View from script

Is it possible to create view from PHP script?

Yes it is possible. We have not documented the feature (but it will come soon see )
The code to achieve that is the following :

$name = “dev_myView”;
$map = ‘{“views”:{“myview”:{“map”:“function (doc, meta) { emit(, NULL); }”}}}’;
$ret = $cb->setDesignDoc($name, $map);

If you need more information you can look at the test cases: