Use Laravel without a database - php

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.

Related

How can i download a file created in an old app in my new Laravel App

There are two applications, an old one written in raw php and a new one in Laravel 6.
The old one generates a File using dabatase data and i want to know if there is a chance that i can run that function in my laravel app so i don't have to rewrite that function all over again.
The two apps are in the same server.
Should i copy the code of the old app in a Laravel Controller and run it there?, or maybe build an API.
Thanks
Quick answer: don't paste legacy PHP code in a Laravel controller.
Since you have decided to start a new Laravel 6 application, you should try to stick with the Laravel way (and modern PHP coding standards), and therefore rewritte your old legacy code from scratch into your new Laravel app.
There is no shortcut for that, and it might take time, but not only will it last longer in time and be more efficient than the legacy code, it will also help you learn new coding standards.
Here is an article that can help you getting started: How to rewrite a legacy PHP application to Laravel.
If what the old code does is just getting rows from the database and exporting it into a file, that should be fairly simple thanks to Laravel and a composer package like maatwebsite/Laravel-Excel
You can find many articles on Google on How to Export Mysql Data to Excel File in Laravel

How to create default sample data for dev env in Symfony?

Context
I'm working with several people on a Symfony application.
Problem
We would like to have a database filled automatically with sample data, to avoid creating it manually on each developer environment.
Question
Is there an official way to do it or do we need to use .sql files we pass to each other to create sample data?
I've seen that's possible with the .net framework, that's why I ask for Symfony.
Take a look at the DoctrineFixturesBundle.
Also there is another bundle called AliceBundle, which makes it very easy to generate different sets of data.

Using Laravel with external API instead of database

I've been trying to make a mobile app which uses an API to fetch resources. So far, so good. Now I need to make the website and I want to use the same API.
The API is built on the top of Slimframework and illuminate/database. So I'm wondering is it good to use Laravel for something that has no connection to the database directly?
For example, components such as Auth will require to supply a different driver and etc.
Would you recommend using Laravel 4.2 for this kind of purpose? What kind of advice can you give me?
It's time to switch now laravel 5.0. I would recommend you to use Laravel for your purpose.
Yes, that is ok, try using Laravel 5 instead 4.2

Laravel Existing Database

I have a database we use on some of our existing websites, sites were built in Yii framework by another developer so no Laravel, I have set up a new project using laravel but am looking for the best way to link up to that database and return the information.
linking to the database is easy enough, just change the database.php file but I am getting really confused with migrations part and how to call it into a webpage.
So what's the simplest way to go about doing this?
Migrations are used to create or modify database structure. Since you already have a database set up, you don't need to use migrations.
To get accustomed with Laravel I strongly suggest watching:
Laracasts - Laravel 5 Fundamentals
I also suggest you go over the entire Laravel Documentation just to get acquainted with all the framework has to offer.

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

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).

Categories