PHP library access Firebase RESTful API alternatives and similar libraries
Based on the "Database" category.
Alternatively, view PHP library access Firebase RESTful API alternatives based on common mentions on social networks and blogs.
-
Doctrine Extensions
Doctrine2 behavioral extensions, Translatable, Sluggable, Tree-NestedSet, Timestampable, Loggable, Sortable -
Idiorm
A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5. -
Doctrine2 Behaviors
Doctrine2 behavior traits that help handling Blameable, Loggable, Sluggable, SoftDeletable, Uuidable, Timestampable, Translatable, Tree behavior -
Cake ORM
[READ-ONLY] A flexible, lightweight and powerful Object-Relational Mapper for PHP, implemented using the DataMapper pattern. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp -
Symfony-RDM
Helps with the use of domain driven design & rich domain model in symfony / doctrine applications. -
PDOPlusPlus
A PHP single class PDO Wrapper : PDO++ (alias PPP) - CRUD - SP - BIGINT natively compatible
InfluxDB - Power Real-Time Data Analytics at Scale
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of PHP library access Firebase RESTful API or a related project?
README
PHP library access Firebase RESTful API
Installation
$ composer require jaredchu/jc-firebase-php
Usage
Generate a private key in JSON format.
Check Firebase credential
use JC\Firebase\JCFirebase;
$firebaseURI = "https://<DATABASE_NAME>.firebaseio.com";
$jsonKeyFile = "path/to/serviceAccountKey.json";
$firebase = new JCFirebase::fromKeyFile( $firebaseURI, $jsonKeyFile );
if( $firebase->isValid() ){
//do something
}
GET - Reading Data
$response = $firebase->get('user');
echo $response->success;
echo $response->body;
PUT - Writing Data
$response = $firebase->put('user', array('data' => array('first_name'=>'Jared','last_name'=>'Chu')));
echo $response->status_code;
echo $response->body;
POST - Pushing Data
$response = $firebase->post('log', array('data' => array('code'=>401,'message'=>'Not Authorized')));
echo $response->status_code;
echo $response->body;
PATCH - Updating Data
$response = $firebase->patch('user', array('data' => array('first_name'=>'Jared',
'last_name'=>'Leto','age'=>27)));
echo $response->status_code;
echo $response->body;
DELETE - Removing Data
$response = $firebase->delete('user/first_name');
echo $response->status_code;
echo $response->body;
Modeling
Create Firebase connector
use JC\Firebase\JCFirebase;
$firebaseURI = "https://<DATABASE_NAME>.firebaseio.com";
$jsonKeyFile = "path/to/serviceAccountKey.json";
$firebase = new JCFirebase::fromKeyFile( $firebaseURI, $jsonKeyFile );
Extend your Model with FirebaseModel
class Log extends FirebaseModel {
/**
* @var integer
*/
public $code;
/**
* @var string
*/
public $message;
}
Get record
$log = Log::findByKey( $key, $firebase );
echo $log->key;
echo $log->code;
echo $log->message;
$logs = Log::findAll( $firebase );
foreach ($logs as $log){
echo $log->key;
echo $log->code;
echo $log->message;
}
Create record
$log = new Log( $firebase );
$log->code = 200;
$log->message = 'Success';
$log->save();
Update record
$log = Log::findByKey( $key, $firebase );
$log->code = 400;
$log->message = 'Bad Request';
$log->save();
Delete record
$log = Log::findByKey( $key, $firebase );
$log->delete();
Contributing
- Fork it!
- Create your feature branch:
$ git checkout -b feature/your-new-feature
- Commit your changes:
$ git commit -am 'Add some feature'
- Push to the branch:
$ git push origin feature/your-new-feature
- Submit a pull request.
License
Support on Beerpay
Hey dude! Help me out for a couple of :beers:!
*Note that all licence references and agreements mentioned in the PHP library access Firebase RESTful API README section above
are relevant to that project's source code only.