Giter VIP home page Giter VIP logo

laravel-realworld-example-app's Introduction

Laravel implementation of RealWorld app

This Laravel app is part of the RealWorld project and implementation of the Laravel best practices.

You might also check Ruby on Rails version of this app.

See how the exact same Medium.com clone (called Conduit) is built using different frontends and backends. Yes, you can mix and match them, because they all adhere to the same API spec

How to run the API

Make sure you have PHP and Composer installed globally on your computer.

Clone the repo and enter the project folder

git clone https://github.com/alexeymezenin/laravel-realworld-example-app.git
cd laravel-realworld-example-app

Install the app

composer update
composer install
composer require fakerphp/faker --dev
cp .env.example .env

Run the web server

php artisan serve

That's it. Now you can use the api, i.e.

http://127.0.0.1:8000/api/articles

You might need y to install the pdo_sqlite extension :

sudo apt-get install php-sqlite3

and un-comment this line in your php.ini

;extension=pdo_sqlite # original
extension=pdo_sqlite # necessary

set up a test environnement

install php-unit

sudo apt install php-cli \
                 php-json \
                 php-mbstring \
                 php-xml \
                 php-pcov \
                 php-xdebug

install with composer

composer require --dev phpunit/phpunit ^11 -w
./vendor/bin/phpunit --version

configuration

un-comment // add // fill this line in your php.ini

error_reporting=-1
xdebug.show_exception_trace=0
xdebug.mode=coverage

you can't run test just like that. you have to downgrade your phpunit version in the composer.json :

    "require-dev": {
        # other stuff
        "phpunit/phpunit": "^9.0"
    },

always end with a

composer update

create a test

php artisan make:test UserTest --unit

run tests

run one of this

./vendor/bin/phpunit
php artisan test
php artisan test --stop-on-failure # nice one

laravel-realworld-example-app's People

Contributors

alexeymezenin avatar augustinpech avatar susanhsrestha avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.