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
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
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
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
php artisan make:test UserTest --unit
run one of this
./vendor/bin/phpunit
php artisan test
php artisan test --stop-on-failure # nice one