Upgrade GuideMonolith

Ensure that your tests are passing at the initial state of the upgrade to be able to compare with by the end that you’ve received the expected result.

  • remove deprecated Lucid packages

    composer remove lucid-arch/laravel-foundation lucid-arch/laravel-console

    It is expected to see failures in the post-script since there are classes that no longer exist

  • add lucidarch/lucid

    composer require lucidarch/lucid


Moving everything from /src to /app

  • Data

  • Domains

  • Foundation

  • Services

  • Services/<service>/Tests/Featurestests/Feature/Services/<service>

  • Services/<service>/Tests/Operations and other unit tests → tests/Unit/Services/<service>/Operations

  • Move domain tests app/Domains/<domain>/Teststests/Unit/Domains/<domain>

    use the script below to do that for you, run it at the root of the project:

    mkdir $BASE_DIR/tests/Unit/Domains
    for d in ./app/Domains/* ; do
        echo "moving $d/Tests --> $TESTS_DIR/Unit/Domains/$DOMAIN"
        mv "$d/Tests" $TESTS_DIR/Unit/Domains/$DOMAIN
    mkdir $BASE_DIR/tests/Unit/Services $BASE_DIR/tests/Feature/Services
    for s in ./app/Services/* ; do
        echo "moving $s/Tests/Features --> $TESTS_DIR/Feature/Services/$SERVICE"
        mv "$s/Tests/Features" $TESTS_DIR/Feature/Services/$SERVICE
        echo "moving $s/Tests/Operations --> $TESTS_DIR/Unit/Services/$SERVICE/Operations"
        mv "$s/Tests/Operations" $TESTS_DIR/Unit/Services/$SERVICE/Operations


  • Rename Framework namespaces in /app
    • namespace Framework\namespace App\
    • use Framework\use App\
  • Rename Framework in /bootstrap , /app and /config
    • Framework\App\
  • Rename custom namespace in /app
    • namespace SocialSource\namespace App\
    • use SocialSource\use App\
  • app/RouteServiceProvider.php rename Framework\ to App\ in protected $namespace

Replace unit namespaces (find & replace in app folder. Additionally you may want to search other folders such as tests):

  • Jobs

    use Lucid\Foundation\Job;use Lucid\Units\Job;

  • Operations

    use Lucid\Foundation\Operation;use Lucid\Units\Operation;

  • Features

    use Lucid\Foundation\Feature;use Lucid\Units\Feature;

  • Services


  • Controllers

    use Lucid\Foundation\Http\Controller;use Lucid\Units\Controller;

  • Exceptions


  • Validator

    use Lucid\Foundation\Validator;use Lucid\Validation\Validator;

  • Replace traits namespaces

    • use Lucid\Foundation\ServesFeaturesTrait;use Lucid\Bus\ServesFeatures;
    • use ServesFeaturesTrait;use ServesFeatures;
  • Update phpunit.xml

    • Remove Services and Domains testsuits


  • delete the line under autoload.psr-4: "Framework\\": "app/",
  • reset namespace of src "App\\": "app/",

The following content (besides custom ones) must be present in composer.json:

    "autoload": {
        "psr-4": {
            "App\\": "app/"
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
  • Run composer dump-autoload to feel the waters

    This time it should all be clear of errors. Otherwise, keep digging and replacing until it passes

  • Run tests again and expect the same results as in the run before the upgrade