creasi/skeleton

Application Project Skeleton for Creasi.co

v0.1.3 2023-10-29 03:06 UTC

README

Version License Actions Status

Application Skeleton

Requirements

  • PHP >= v8.1 and Composer >= v2.0
  • Node.js >= v16.0 and PNPM v8.x
  • Database Server (MySQL, MariaDB or PostgreSQL)

Stacks

Setup

  1. Clone the repository and cd into it

    git clone git@github.com:creasico/laravel-project.git my-project && cd $_
  2. Install composer and pnpm dependencies

  3. Copy .env.example file to .env file & generate new app key

  4. Create new database and update your .env file accordingly

    # for MySQL (presumably you've already have mysql client)
    $ mysql -e 'create database <db-name>'
    
    # for PostgreSQL (presumably you've already have postgresql client)
    $ createdb <db-bame>
  5. All things set? then run

    $ php artisan migrate --seed  # run database migration
    $ pnpm build                  # compile front-end assets
  6. You're good to go

Development

Front-end

This project is using windi.css and vue.js with inertia.js as default front-end library, which mean any changes you've made, won't appears immadiately unless you run the following command

$ pnpm dev

Testing

This skeleton is already have pre-configured for testing using built-in and official testing utility of Laravel Framework, which is phpunit and laravel dusk.

Unit Tests

All we need to do is spare another database for testing. The reason behind it is while we run our tests, it will reset all of our existing development database. For more information please consult to the official documentation.

Once you've create new database, you can copy your .env file to .env.testing and update the database configuration with the newly created database.

$ composer test:unit       # to run unit test

Integration Tests

Before you begin tests using laravel dusk, please make sure you've already install the webdriver with the following command

$ php artisan dusk:chrome-driver --detect

By default that command will install the latest ChromeDriver meaning you'll have to make sure that the installed version of ChromeDriver matches with version of your locally installed Google Chrome, then run

$ composer test:e2e        # to run end-to-end test using larvel-dusk

By default laravel dusk will runs headlessly, if you willing to disable headless mode, just uncomment DUSK_HEADLESS_DISABLED in your .env.testing file. For more info please consult to the official documentation

Note The .env.example also preconfigured with BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY which is necessary to run integration testing on BrowserStack, feel free to comment out those variables if you don't want to run it locally. Please consult to their official documentation for local testing.

Contributing

Sponsors

BrowserStack Logo

License

The project is an open-source software licensed under the MIT license.