A PHP framework for web artisans.

Overview

Build Status Total Downloads Latest Stable Version License

About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

Laravel is accessible, powerful, and provides tools required for large, robust applications.

Learning Laravel

Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

If you don't feel like reading, Laracasts can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

Laravel Sponsors

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel Patreon page.

Premium Partners

Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.

Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [email protected]. All security vulnerabilities will be promptly addressed.

License

The Laravel framework is open-sourced software licensed under the MIT license.

Issues
  • [8.x] Use Pest as the default testing framework

    [8.x] Use Pest as the default testing framework

    This PR proposes to use Pest as the default testing framework in Laravel.

    Advantages

    Simple

    Pest adheres to Laravel's core values by design. Its main focus is on simplicity:

    Powerful

    Pest provides handy shortcuts to perform common actions in your tests:

    Backward compatible

    First of all, PHPUnit would still be part of Laravel, as internally, Pest works on top of it. This should reassure most people with years of PHPUnit experience:

    • Pest can run existing PHPUnit test suites natively, no need to rewrite them
    • Pest can be a progressive buy-in, just write your new tests with its syntax
    • You can still run PHPUnit if you don't want to try Pest

    Code example

    The syntax should be familiar if you’ve used other testing tools such as Mocha or Jest. Here’s a quick example of what you can expect:

    <?php
    
    beforeEach(fn () => factory(App\User::class)->create());
    
    it('has a home page', function () {
        $this->get('/')->assertOk();
    });
    

    With its clean syntax, Pest have proven to help bring a few complete beginners to the testing world. Abstracting away most of PHPUnit's boilerplate code makes it easier for them to learn testing. This in itself should be a big benefit to the community.

    Community

    Pest already has dedicated team members working actively on multiple projects, including:

    opened by nunomaduro 110
  • [6.0] Add PHPUnit bootstrap file to allow execution of console commands before a test run

    [6.0] Add PHPUnit bootstrap file to allow execution of console commands before a test run

    This PR introduces a PHPUnit ~~watcher~~ bootstrap file that caches the config before the test suite runs for the first time, which in my benchmarks reduces the boot time of the Kernel during a test run by ~50% without any additional work by the developer.

    This will only really have an impact on a larger test suite, but personally I think it is a worthwhile thing to consider.

    The benchmark test suite ended up with the following durations:

    • Without caching: 9.15s
    • With caching: 4.2s

    Caching the config before a test run is good for a couple of reasons:

    1. It's faster.
    2. It is closer reflects what you use in production.

    If, for example, you cache your routes in production but try deploy a sneaky closure route, your app is gonna blow up when you go to cache the routes during production. Having this in place will help you catch that kind of thing during testing, either locally or during CI. (you could catch this in CI if you are already calling this command before running the tests).

    The PHPUnit ~~listener~~ bootstrap file will cache the config for the test environment before a test is run. Because it is in "User land" it is 100% opt-in. If you don't want it, don't use it. One handy thing about running the cache command in a ~~PHPUnit listener~~ bootstrap file (as opposed to say in a composer script) is that it will already have the environment variables from the phpunit.xml file loaded, so we don't need to read those ourselves.

    Notes

    • As this doesn't require any changes to the framework, it is totally possible to just package up, which I'm more than happy to do.

    • The watcher could be kept in core with just the phpunit.xml changes made here.

    • it is possible we could see similar results by caching routes and events, but I haven’t tested this yet. I plan to extend the benchmark repo I setup to also have some feature (http) tests so we can see what kind of impact that might have on a test suite as well.

    This PR is a simpler approach to my first run at this: https://github.com/laravel/framework/pull/28998

    opened by timacdonald 66
  • [6.x] Implement integration test and in-memory DB

    [6.x] Implement integration test and in-memory DB

    Hey everyone. With this PR I want to propose a new dedicated Integration test directory and in-memory DB defaults to the default Laravel test suite. As someone who's worked quite a bit with different test suites over the past years I think I can say for myself I have quite some experience in this area and wanted to share some small things through this PR.

    In-memory DB

    The first thing I want to change with this PR is to provide new defaults for the database that's being used when running the test suite of the app. This is probably the very first thing I change for every single app I start working on. All of my tests run in memory against a sqlite database which is pretty fast I must say.

    While it is true that the current default Laravel test suite doesn't requires a database to be set up, it is from my understanding that a lot of people do add these new defaults as soon as they need to start testing against a database. It's also true that an sqlite can't mimic a MySQL or Postgres database which is probably used in production but the speed of an in-memory database makes it much more suited for running tests. Therefor, I believe these are good defaults to have in the skeleton.

    Integration Directory

    From what I often read on issues and on Twitter I still see that there's a lot of confusion about what a Unit test is and what an Integration test is. A unit test is something you test in isolation, without booting the entire app. You, for example, test a single object or function without any outside dependencies and maybe mock some of those dependencies. These tests usually run really fast.

    Integration tests, however, are tests which test the behavior of different components together. They aren't full cycle tests like End-to-End tests or Feature tests but they do require some additional setup (like a database for example). These tests tend to run a bit slower.

    In the current skeleton setup you only have two directories: a Unit test directory and a Feature test directory. I think there's room for an Integration directory which actually copies the behavior of the current Unit test directory. Because you see, the current default Unit ExampleTest extends from the default TestCase. This isn't wanted for unit tests because it boots up the entire framework and thus slows down these tests which should actually run much faster (because they should be isolated).

    What I changed is that I've added a dedicated Integration test directory which keeps the current behavior of extending from the Laravel TestCase class and can be used to test different components in your app which require the framework to be booted. The old Unit ExampleTest is updated to only extend the default PHPUnit Testcase so the framework isn't booted and you get the speed boost for these types of test. It's also ok that you don't have all of the Laravel test methods for the Unit tests because most of these methods are meant for Integration tests and provide no value in Unit tests.

    I also wanted to make a clear different between what a Unit test and what an Integration test is inside the example tests. For the Unit tests I'm testing if the User model accepts a name attribute and that it can be fetched properly (most people also don't realize you can perfectly Unit test Eloquent models as long as you don't do DB operations). For the Integration test I've added an example which actually makes use of the newly in-memory database defaults and I seed three users and fetch them with the User model.

    Conclusion

    What I'm mainly trying to achieve with these changes is to educate people better about testing in general and what the different types of tests are. And I'm hoping this saves a lot of people some time when they start on a new Laravel app (even though the changes are minimal).

    I'm sorry for writing such a large description. I'm usually against these myself hehe. But I wanted to be thorough enough to explain the reasoning behind it 🙂

    Let me know what you think.

    Update: Taking from the feedback here I've made changes to this PR. More info here: https://github.com/laravel/laravel/pull/5169#issuecomment-562202777

    opened by driesvints 65
  • Config-based migrations table name.

    Config-based migrations table name.

    https://github.com/laravel/laravel/issues/1417

    opened by assertchris 42
  • Fixed up the phpunit config

    Fixed up the phpunit config

    We'll need to update the docs to let people know about this.

    opened by GrahamCampbell 40
  • Added Output Buffering

    Added Output Buffering

    Hi,

    So currently, if I have something like this:

    Route::get('/', function()
    {
        echo 'First';
    
        return Redirect::to('second');
    });
    
    Route::get('second', function()
    {
        return 'Second';
    });
    

    The redirect never happens and I just get an empty response. That's because Laravel isn't utilising output buffering. I have added output buffering, which means you can echo anything, set session values or whatever then return an object that's an instance of Laravel\Redirect, and the redirect will happen.

    Signed-off-by: Ben Corlett [email protected]

    opened by bencorlett 37
  • Added @assign Blade function for assigning variables inside Blade view f...

    Added @assign Blade function for assigning variables inside Blade view f...

    opened by nikkobautista 36
  • Support PHP 5.5

    Support PHP 5.5

    With yield becoming a keyword in PHP 5.5, the yield helper and static method cause a syntax error. Prepended an underscore to prevent conflict.

    opened by ghost 33
  • Allow for auto-filling form fields with previous input data.

    Allow for auto-filling form fields with previous input data.

    By simply setting Form::$remember to true, this makes forms automatically be re-filled with the previously entered data - this way this does not have to be done by hand for every field (very tire-some in large forms).

    Some things to note:

    • I realize this adds state to the Form helper class. Is that bad? I don't think so (at least in this case), but...
    • ...maybe there is a more Laravel-ish way for enabling this feature instead of using Form::$remember. I could imagine an extra parameter to Form::open(), but I'm very much looking for suggestions.
    • I haven't yet tested this with select boxes, but don't want to before somebody tells me about the chances of getting this pull request merged.
    • Changing the default $value parameter is necessary so that password fields will not be re-populated.
    • Input::old() has to be repopulated manually, e.g. by redirecting with with_input().
    opened by franzliedke 29
  • [Proposal] More detailed logging

    [Proposal] More detailed logging

    When looking through errors it is not very clear where an error occured. For example 404 errors: from exception 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' in /var/www/html/project/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php:140 you don't know on what path that happend (and beginners don't even get that this is just a 404). Error 404 on GET http://mydomain.com/my-route: exception 'Symfony\... would make much more sense imho..

    (Follow-up on https://github.com/laravel/laravel/pull/2764 for 4.3 branch)

    opened by barryvdh 29
Releases(v8.6.10)
Owner
The Laravel Framework
The Laravel Framework
FlyCubePHP is an MVC Web Framework developed in PHP and repeating the ideology and principles of building WEB applications, embedded in Ruby on Rails.

FlyCubePHP FlyCubePHP is an MVC Web Framework developed in PHP and repeating the ideology and principles of building WEB applications, embedded in Rub

Anton 1 Dec 21, 2021
Framework X – the simple and fast micro framework for building reactive web applications that run anywhere.

Framework X Framework X – the simple and fast micro framework for building reactive web applications that run anywhere. Quickstart Documentation Tests

Christian Lück 350 Jan 12, 2022
💫 Vega is a CLI mode HTTP web framework written in PHP support Swoole, WorkerMan / Vega 是一个用 PHP 编写的 CLI 模式 HTTP 网络框架,支持 Swoole、WorkerMan

Mix Vega 中文 | English Vega is a CLI mode HTTP web framework written in PHP support Swoole, WorkerMan Vega 是一个用 PHP 编写的 CLI 模式 HTTP 网络框架,支持 Swoole、Work

Mix PHP 40 Jan 10, 2022
Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.

Slim Framework Slim is a PHP micro-framework that helps you quickly write simple yet powerful web applications and APIs. Installation It's recommended

Slim Framework 11.2k Jan 18, 2022
Low-code Framework for Web Apps in PHP

Agile UI - User Interface framework for Agile Toolkit Agile Toolkit is a Low Code framework written in PHP. Agile UI implement server side rendering e

Agile Toolkit 372 Jan 11, 2022
A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast! Condensed in a single ~65KB file

Bong Cosca 2.5k Jan 5, 2022
Leaf is a PHP framework that helps you create clean, simple but powerful web apps and APIs quickly and easily.

Leaf is a PHP framework that helps you create clean, simple but powerful web apps and APIs quickly and easily. Leaf introduces a cleaner and much simpler structure to the PHP language while maintaining it's flexibility. With a simple structure and a shallow learning curve, it's an excellent way to rapidly build powerful and high performant web apps and APIs.

Leaf Framework 445 Jan 19, 2022
Woski is a fast and simple lightweight PHP Framework for building applications in the realm of the web.

Woski is a simple fast PHP framework for the Realm The Project Installation Clone the repository $ composer create-project clintonnzedimma/woski myApp

Clinton Nzedimma 17 Dec 16, 2021
A magic PHP framework. Build reactive web apps without writing HTML, CSS, or JavaScript! Powered by Tailwind, Alpine, Laravel, & Livewire.

Malzahar A magic PHP framework. Build reactive web apps without writing HTML, CSS, or JavaScript! Powered by Tailwind, Alpine, Laravel, & Livewire. Re

null 17 Dec 13, 2021
Biny is a tiny, high-performance PHP framework for web applications

Biny is high performance. Framework comes default with response time of less than 1ms. Stand-alone QPS easily up to 3000.

Tencent 1.6k Jan 16, 2022
ReikoFramework - The PHP Web Framework for simplicity

Reiko Framework - The PHP Web Framework for simplicity. What is Reiko? Reiko Framework is PHP Web framework for simplicity, if you need built web appl

shutdown57 3 Oct 18, 2021
TrailLamp is a lightweight, easy-to-use Php MVC framework that can be used to build web applications and REST APIs.

TrailLamp Introduction TrailLamp is a lightweight, easy-to-use Php MVC framework that can be used to build web applications and REST APIs. Installatio

Etorojah Okon 11 Nov 9, 2021
Flare is a PHP full-stack web framework that is light, fast, flexible, and secure.

Flare framework is a PHP full-stack web framework that is simple ,powerful , fast , flexible, and secure with long-term support.

Flare framework 1 Jan 6, 2022
CleverStyle Framework is simple, scalable, fast and secure full-stack PHP framework

CleverStyle Framework is simple, scalable, fast and secure full-stack PHP framework. It is free, Open Source and is distributed under Free Public Lice

Nazar Mokrynskyi 149 Aug 12, 2021
I made my own simple php framework inspired from laravel framework.

Simple MVC About Since 2019, I started learning the php programming language and have worked on many projects using the php framework. Laravel is one

null 13 Nov 17, 2021
PHPR or PHP Array Framework is a framework highly dependent to an array structure.

this is new repository for php-framework Introduction PHPR or PHP Array Framework is a framework highly dependent to an array structure. PHPR Framewor

Agung Zon Blade 1 Dec 26, 2021
I made my own simple php framework inspired from laravel framework.

Simple MVC About Since 2019, I started learning the php programming language and have worked on many projects using the php framework. Laravel is one

Rizky Alamsyah 13 Nov 17, 2021
Framework X is a simple and fast micro framework based on PHP

Framework X is a simple and fast micro framework based on PHP. I've created a simple CRUD application to understand how it works. I used twig and I created a custom middleware to handle PUT, DELETE methods.

Mahmut Bayri 2 Jan 19, 2022
Primera Evaluación asociada a la Asignatura de Framework y Programación Web

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Luis Garcés S. 1 Oct 22, 2021