i am creating a php project for myself and it is not on laravel, i install illuminate/database package on my project for using elequent and its work perfectly.
now i want to use laravel routing system in my project but can not find any Instructions for this
is there any way to use that?
yes you can use all illuminate component like router in your project.you should see : https://github.com/mattstauffer/Torch Torch is a project to provide instructions and examples for using Illuminate components as standalone components in non-Laravel applications.
I would recommend you do too if you like that. https://symfony.com/doc/current/routing.html#creating-routes
If you would like another package that works much similar to Laravel routing, take a look at Klein.
Related
I have an existing laravel project with AlpineJS. I wanted to integrate authentication but not able to find a proper solution having in mind I DONT USE VUE. I have done this with Vue but just wanted to know if there's an updated guide for Laravel with Alpine JS. I tried to look into documentation but wasnt able to find something related.
composer require laravel/ui
php artisan ui:auth
Do I still need to do this? Any suggestions for best practices?
Alpine is just a lightweight framework for DOM manipulation, it's not going to provide any authentication functionality alone so you will need to add something to your project.
If you're wanting to add authentication to your application, you'll want to consider something like Laravel Fortify which is a headless front end agnostic authentication solution. There are starter kits such as Breeze or Jetstream, however, adding either of these boilerplate start kits to existing projects can have issues. Some people recommend starting a new project, installing one of them and them porting your existing functionality across (this will obviously depend on the scale of your project).
I want to use Laravel to create an API only. But when I create the laravel project using:
composer create-project --prefer-dist laravel/laravel myApi
I get a lot of files like package.json or some Webpack configuration. These files are very useful to create some front-end interfaces, but I don't really need that since I only want my Laravel project to interact with a database and answer to some API calls.
Is there a way to initially create a Laravel project without all the front-end stuff? Something like:
composer create-project --prefer-dist laravel/laravel myApi --api
Use Lumen instead
Lumen is the perfect solution for building Laravel based
micro-services and blazing fast APIs. In fact, it's one of the fastest
micro-frameworks available. It has never been easier to write
stunningly fast services to support your Laravel applications.
Or
You may use Slim micro framework
Slim is a PHP micro framework that helps you quickly write simple yet
powerful web applications and APIs.
I want to make API (Laravel) and SPA (Vue.js) that uses this API. But I am not sure how to accomplish that.
2 separate projects (1 Laravel project for API and 1 Vue.js project for SPA)
or
1 Laravel project for both API (routes/api.php) and SPA (routes/web.php)
Which one to choose?
Separated projects are more clean and organized while all in one project is more practical.
What I do is create two different repositories ((project-api or project-server or project-backend) and (project-client or project-frontend)) if is a medium-large project and work on them completely separated. Both projects don't know nothing about each other.
Obs: The routing system on frontend is not managed by Laravel as appeared in what you wrote here and SPA (routes/web.php).
If you want to use separate projects, I suggest you use Vue-CLI for scaffolding Vue.js projects and Vue-Resource for web requests (XmlHttpRequest or JSONP)
Laravel also provides Laravel Elixir that support CSS and Javascript using Gulp and Webpack.
First, You must install node.js and npm, from there on I would suggest that you read the documentation to get you going further.
this is not a code question about laravel 5.*, it's more like to know if you guys develop your applications using packages ("package driven development" ? Not sure if this is the right definition).
What I mean is: Instead of building an application and create controllers in app/Http/Controllers/, you wrap everything in a package and then 'require' that package using composer (like a wordpress plugin).
I'm trying to think in a way to isolate the core Laravel from my specific application and save time later when it's time to upgrade when a new Laravel version is available.
In my case I'm having some issues moving from version 5.2 to 5.3 because I have some customization in the registration and login process - It might be because I'm not using the right approach to write the code (patterns), so I'd like to hear from more experienced Laravel developers.
Thanks!
The great thing about Laravel, there's almost always a package for what you want to do. You can either create your packages as packages on composer, or you can install a module package and create them as modules.
For my projects I tend to use caffeinated/modules. I've tried a few and IMO it's the easiest to use.
My website already have MVC architecture. I want to expand his capabilities by installing Laravel framework.
Can I just copy unzipped Laravel framework, so all folders and libraries are just copy/pasted. ?
I have VPS Ubuntu 12.04 and PHP 5.4.4
In which form your website has MVC architecture implemented ?
Is that through your plain PHP code or through some other framework ?
Laravel is implementing MVC architecture on its own way. In order to use that Laravel MVC capabilities, you will have to move all your logic inside Laravel.
UPDATE WITH SOME RESOURCES:
Official Laravel documentation
Laracasts - video lessons
Laravel IRC channel.
Good luck
The fact that you have used MVC does not mean that it will fit laravel's structure unfortunatelly. With different file structure, routing, controllers and models it wont work that way.
I dont know how advanced and expanded your page is, but you will probably re-write it laravel way.
Steps that you will need (assuming that you have some knowlege about laravel):
Prepare models for your existing database
Add routes for pages that you will need, create controllers for them using models
If you have used smarty templates, you can install smarty bundle for laravel, otherwise you will have re-write you templaets to blade (default laravel's templating engine)