Posts

Showing posts with the label laravel

Laravel vs other framework

 Laravel is just one of many PHP frameworks available for web development, and each framework has its own strengths and weaknesses. Here are some comparisons between Laravel and other popular PHP frameworks: Laravel vs Symfony: Symfony is a mature PHP framework that provides a set of reusable components and tools for building scalable web applications. Laravel is built on top of Symfony and adds a number of features and conventions to make web development faster and easier. Symfony is generally considered to be more flexible and better-suited for large-scale applications, while Laravel is often preferred for smaller projects or rapid application development. Laravel vs CodeIgniter: CodeIgniter is a lightweight PHP framework that is easy to learn and use. It is often preferred for smaller projects or projects with tight deadlines, as it is faster to get started with than Laravel. However, Laravel is generally considered to be more powerful and better-suited for larger or more complex pr

why use Laravel in Your Next Project ?

 Laravel is a popular PHP framework that is used by many developers and businesses to build web applications quickly and efficiently. Here are some reasons why Laravel is a good choice for many projects: Elegant syntax: Laravel has an elegant and expressive syntax that makes it easy to write and read code. This can save time and make the development process more efficient. Modular structure: Laravel is designed with a modular structure that makes it easy to build complex web applications in a structured and organized way. This can help improve the maintainability and scalability of the application over time. Built-in features: Laravel comes with many built-in features that make it easy to implement common functionality in web applications, such as authentication, routing, caching, and more. This can save time and reduce the amount of code that needs to be written from scratch. Testing support: Laravel provides built-in support for testing, making it easy to write and run tests to ensur

Laravel Introduction

What is Laravel? Laravel is a free, open-source PHP web application framework, designed to help developers build efficient, scalable, and maintainable web applications. It was created by Taylor Otwell in 2011 and has since become one of the most popular PHP frameworks available. Laravel offers a variety of features that make it easy to develop modern web applications, including a robust routing system, a powerful ORM (Object-Relational Mapping) tool, and a flexible template engine called Blade. It also includes built-in support for authentication, authorization, and security features such as CSRF (Cross-Site Request Forgery) protection. One of the key benefits of Laravel is its active and supportive community, which has created numerous packages and extensions to extend the framework's capabilities. This makes it easy for developers to find solutions to common problems and quickly add new functionality to their applications. Overall, Laravel is a powerful and versatile framework th

Laravel Login & Logout Using Session & Middleware

 Create Middleware : LoginMiddleware  <?php namespace   App\Http\Middleware ; use   Closure ; use  Illuminate\Http\ Request ; use  Illuminate\Support\Facades\ Session ; class   LoginMiddleware {      public   function   handle ( Request   $request ,  Closure   $next )     {          if (! $user  =  Session :: get ( 'user' )){              return   redirect ( 'login' );         } else  {              return   $next ( $request );         }     } } Now Register Middleware in App/Http/kernal.php     protected   $routeMiddleware  = [           'loginAuth'  => \App\Http\Middleware\ LoginMiddleware :: class ,     ]; Now In Web.php Route :: get ( '/' , 'LoginController@index' )-> name ( 'login' ); Route :: get ( '/login' , 'LoginController@index' )-> name ( 'user-login' ); Route :: get ( '/logout' , 'LoginController@logout' )-> name ( 'logout' ); Route :: post ( 'login-process'

How to use Costom Library in laravel

Route: Route :: group ([ 'prefix' => '' , 'namespace' => 'Front' ] , function (){ Route :: get ( '/' , 'NewsController@index' ); }); Controller : <?php namespace App\Http\Controllers\Front ; use App\Http\Controllers\Controller ; use App\Library\API\News_Api ; use Illuminate\Http\Request ; class NewsController extends Controller { public function index (){ $news_details = []; $news = ( new News_Api ())-> News_get ( $news_details ); dd ( $news ); } } Library : <?php namespace App\Library\API ; use GuzzleHttp\Client ; class News_Api { function News_get ( $news_details ){ $news = ( new Client ())-> request ( 'GET' , env ( 'NEWS_BASE_URL' ) ,[ 'query' => [ 'query1' => '' ] ]); return json_decode ((string) $news -> getBody ()); } }