cmoore4 / phalcon-rest Goto Github PK
View Code? Open in Web Editor NEWA Base project for APIs using the Phalcon framework
License: MIT License
A Base project for APIs using the Phalcon framework
License: MIT License
Maybe in the constructor, but would need some path knowledge.
Implement an example controller using Phalcon ORM models and the query builder.
This needs tests.
Currently, all errors are returned as JSON, with an incorrect envelope implementation. Errors should respect the API conventions, too.
Hi everyone, I've used Phalcon micro for a couple of months, and now I want to switch to something more RESTful, and I found this repo https://github.com/cmoore4/phalcon-rest
I've declared database parameters in config.ini
[database]
adapter = Mysql
host = localhost
username = test
password = test
name = test
I've set the di to connect to db
$di->set('db', function() use ($config) {
$dbclass = 'Phalcon\Db\Adapter\Pdo\\' . $config->database->adapter;
return new $dbclass(array(
"host" => $config->database->host,
"username" => $config->database->username,
"password" => $config->database->password,
"dbname" => $config->database->name
));
});
Class Princesses.php in is models folder
When I tried to add this line
$princesses = Princesses::find();
What is the problem here?
Thank you very much. Any help is appreciated!
The JSON envelope is arbitrary. While it makes the API more discoverable, it also violates strict REST principles.
Add an "envelope=false" query parameter that moves the _meta information into HTTP headers.
I believe composer support + autoloading would be awesome for this.
I not show image in api?
Hi,
Thanks, for the framework. It works great .
I would like to validate the user in the entry point ( RESTController ) .
I wrote a common method in RESTController, But the action continue executing
after return statement.
Can you suggest me how do I do ?
Raja K
When I run this request:
http://api.phalconrest.local/v1/example
I get the error:
Fatal error: Using $this when not in object context in /var/www/phalcon-rest/controllers/ExampleController.php on line 29
I found that the problem is in index.php line 196, by replacing this:
->setHandler('\PhalconRest\Controllers\ExampleController');
with this:
->setHandler(new \PhalconRest\Controllers\ExampleController());
all works well.
Please Help about Connect to Any Mysql DataBase and Get data from tables and response same $examplerecords in Examplecontroller.php
tnx
All the JSON response generation is done inline within the index file. This needs to be refactored out into a JSONResponse class.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.