Laravel (Main Website) + Node (Scraper) + DB - php

I am creating a website using the Laravel framework that requires the utilization of some data. This data is being collected by a scraper implemented with Node.js. My approach is to collect the data and store it on a database (MongoDB) and read it with Laravel.
I came across this solution, should I work with it?
Is there another way to push data from Node.js into MongoDB and then read the same MongoDB in Laravel?

Your Node.js app should save data into your MongoDB database, and your Laravel app should read that data only when needed - your solution is clearly not the way to go.
There is a library that allows using a MongoDB just like a standard database using the same Eloquent methods : laravel-mongodb, you should definitely check it out and use it (or find an equivalent).

Related

Use Laravel without a database

I was wondering if the use of a database is necessary on Laravel or I can build an app without database.
I have researched throughout but there is no clear indication of these nor on the Laravel documentation website or other places, it is just vague.
Thanks
Of course you can use Laravel without a database. You can read and save data using remote RESTful API, files etc or you can do not use any data layer at all. Laravel will work just fine.
Also, you can use pretty cool SQLite library which allows you to save all info to a single file. Laravel supports it out of box.

Redis as NoSQL Key/Value Database in CakePHP 3

I'am wondering what is the best way to use Redis NoSQL Database in CakePHP not for Caching but as regular Key/Value Store?
There is a Plugin for Redis 2.4.2 or higher, but the Plugin does not work with CakePHP 3.x: Redis CakePHP 2.4.2 Plugin
What is the best way to use Redis in CakePHP 3 as regular Key/Value Database? How costly is it to upgrade the CakePHP 2.4.2 Redis-Plugin to a CakePHP 3.x Plugin. Is the migration of the Plugin the best way or is it better to create a new Datasource? (The current Redis-Plugin extends the Datasource-class.)
Take a close look at what that datasource does, it's pretty much just a proxy to a Redis class instance, other than that it only handles connecting and disconnecting.
So besides having auto connect/disconnect functionality, there is pretty much no point in implementing such a datasource, and you could also just use Redis directly instead.
https://github.com/phpredis/phpredis#classes-and-methods
If you'd wanted to use it as a datasource, ie have it accessible via the connection manager, then you'll have to implement \Cake\Datasource\ConnectionInterface.
If you are looking for a datasource that acts as an ORM, that's a complete different story, and a rather complex task, see for example the CakePHP ElasticSearch Datasource plugin.

Laravel with DB2 Database

Hi guys I'm new with Laravel and I want to use it to build a REST API and the routing is just great my only problem now is the database , I read that Laravel only supports just four database systems http://laravel.com/docs/database#configuration and I need to use IBM DB2 , so is there any alternative to this? I mean like another library and if is possible to integrate with this framework. (I'm not using ODBC)
You can swap out Eloquent and use Doctrine which supports DB2.
Doctrine is on composer so can be easily loaded.

What are the advantages of ember data and how I can used

I noticed a new feature in ember.js since RC version. I've been reading about it and I know it now can populate data into a model. But what are the advantages and disadvantages of this? My model its populated through JSON but I don't know if it's the best solution.
The other part of my question is: how can I use the ember data for example with zend framework?
I believe you are talking about Ember Data. I used this at a company I worked for a few months ago. At the time it was barely introduced into the main Ember.js repository (we were using it back in the day when it was a second repo called ember-data). It's a pretty nifty feature that allows for simple/rapid CRUD. It's specifically designed to work with Ruby on Rails but with some modifications to your backend you can get it to communicate with Ember Data. From their website:
Without any configuration, Ember Data can load and save records and relationships served via a RESTful JSON API, provided it follows certain conventions.
So its main benefit is rapid development in Ember for communicating with a web service to get and update data. So if your site is getting and saving data just fine you probably don't need to switch. At least wait until it's in a stable release. If you're starting a new app and don't plan on releasing to the public and don't mind having to fix breaking changes (trust me they happen weekly) then Ember Data can be a real help!

Data import and migrate using Doctrine

I need to load data from an old DB into a migrated schema of this DB using Doctrine migration system.
I guess Doctrine might help me in this process.
I tried and lost a few hours using ETL scripts programs, without success.
From my point of view I need to :
Create a DB with the V0 schema
Load the data from the old DB (schema are identical)
Migrate DB to latest version using Doctrine migration
Extract data
Load it in the new DB
WHat do you think of this process?
Do you think it is feasable using Doctrine?
I tried a few searches on Google without success.
I am currently reviewed the features of Doctrine_Core class.
Thanks for your help
Yes, it is possible to migrate data from one database to another using Doctrine.
It sounds like you're trying to do a one-time database revision and migration and that your applications are not currently written using Doctrine. In that scenario, database abstraction has little or no benefit, unless you're also rewriting the applications to use it.
If you have no prior experience using Doctrine then I seriously doubt that writing custom migration classes in it will be easier than doing it with whatever database API you are already experienced using. It makes sense to use the migration classes (some times) if you are already using Doctrine for your development. Otherwise it's another layer and API you don't need.
I'm using Doctrine 1.2, which has some nice features for migrations but also a number of bugs and omissions of expected functionality. Reportedly version 2 improves on this but I haven't used it yet.

Categories