Skip to content

Instantly share code, notes, and snippets.

@catgofire
Last active May 17, 2024 01:29
Show Gist options
  • Save catgofire/f2e203973ff753428d44f309c5883e22 to your computer and use it in GitHub Desktop.
Save catgofire/f2e203973ff753428d44f309c5883e22 to your computer and use it in GitHub Desktop.
Sage 9 hacky compatibility update files
<?php
// config/app.php
use Illuminate\Support\Facades\Facade;
use function Roots\env;
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Acorn'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => defined('WP_ENV') ? WP_ENV : env('WP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => WP_DEBUG && WP_DEBUG_DISPLAY,
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', home_url()),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => get_option('timezone_string', 'UTC'),
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => get_locale(),
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => 'file',
// 'store' => 'redis',
],
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Routing\RoutingServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Roots\Acorn\Assets\AssetsServiceProvider::class,
Roots\Acorn\Filesystem\FilesystemServiceProvider::class,
Roots\Acorn\Providers\AcornServiceProvider::class,
Roots\Acorn\Providers\RouteServiceProvider::class,
Roots\Acorn\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\ThemeServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => Facade::defaultAliases()->merge([
// 'ExampleClass' => App\Example\ExampleClass::class,
])->toArray(),
];
<?php
// config/assets.php
// if your current assets.php has "/dist/mix-manifest.json" replace it with this
return [
/*
|--------------------------------------------------------------------------
| Default Assets Manifest
|--------------------------------------------------------------------------
|
| Here you may specify the default asset manifest that should be used.
| The "theme" manifest is recommended as the default as it cedes ultimate
| authority of your application's assets to the theme.
|
*/
'default' => 'theme',
/*
|--------------------------------------------------------------------------
| Assets Manifests
|--------------------------------------------------------------------------
|
| Manifests contain lists of assets that are referenced by static keys that
| point to dynamic locations, such as a cache-busted location. A manifest
| may employ any number of strategies for determining absolute local and
| remote paths to assets.
|
| Supported Strategies: "relative"
|
| Note: We will add first-party support for more strategies in the future.
|
*/
'manifests' => [
'theme' => [
'strategy' => 'relative',
'path' => get_theme_file_path('/dist'),
'url' => get_theme_file_uri('/dist'),
'manifest' => get_theme_file_path('/dist/mix-manifest.json'),
]
]
];
<?php
// config/assets.php
// if your current assets.php has "/public/mix-manifest.json" replace it with this
return [
/*
|--------------------------------------------------------------------------
| Default Assets Manifest
|--------------------------------------------------------------------------
|
| Here you may specify the default asset manifest that should be used.
| The "theme" manifest is recommended as the default as it cedes ultimate
| authority of your application's assets to the theme.
|
*/
'default' => 'theme',
/*
|--------------------------------------------------------------------------
| Assets Manifests
|--------------------------------------------------------------------------
|
| Manifests contain lists of assets that are referenced by static keys that
| point to dynamic locations, such as a cache-busted location. A manifest
| may employ any number of strategies for determining absolute local and
| remote paths to assets.
|
| Supported Strategies: "relative"
|
| Note: We will add first-party support for more strategies in the future.
|
*/
'manifests' => [
'theme' => [
'strategy' => 'relative',
'path' => get_theme_file_path('/public'),
'url' => get_theme_file_uri('/public'),
'manifest' => get_theme_file_path('/public/mix-manifest.json'),
]
]
];
<?php
// app/Providers/ThemeServiceProvider.php
namespace App\Providers;
// use Roots\Acorn\ServiceProvider;
use Roots\Acorn\Sage\SageServiceProvider;
// class ThemeServiceProvider extends ServiceProvider
class ThemeServiceProvider extends SageServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
parent::register();
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
parent::boot();
}
}
<?php
// config/view.php
use function Roots\resource_path;
use function Roots\storage_path;
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most template systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views.
|
*/
'paths' => [
get_theme_file_path('/resources/views'),
get_parent_theme_file_path('/resources/views'),
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the uploads
| directory. However, as usual, you are free to change this value.
|
*/
// 'compiled' => storage_path('framework/views'),
'compiled' => get_theme_file_path('/storage/framework/views'),
/*
|--------------------------------------------------------------------------
| View Debugger
|--------------------------------------------------------------------------
|
| Enabling this option will display the current view name and data. Giving
| it a value of 'view' will only display view names. Giving it a value of
| 'data' will only display current data. Giving it any other truthy value
| will display both.
|
*/
'debug' => false,
// 'debug' => 'view',
// 'debug' => true,
/*
|--------------------------------------------------------------------------
| View Namespaces
|--------------------------------------------------------------------------
|
| Blade has an underutilized feature that allows developers to add
| supplemental view paths that may contain conflictingly named views.
| These paths are prefixed with a namespace to get around the conflicts.
| A use case might be including views from within a plugin folder.
|
*/
'namespaces' => [
/*
| Given the below example, in your views use something like:
| @include('MyPlugin::some.view.or.partial.here')
*/
// 'MyPlugin' => WP_PLUGIN_DIR . '/my-plugin/resources/views',
],
/*
|--------------------------------------------------------------------------
| View Directives
|--------------------------------------------------------------------------
|
| The namespaces where view components reside. Components can be referenced
| with camelCase & dot notation.
|
*/
'directives' => [
// 'asset' => Roots\Acorn\Assets\AssetDirective::class, // The old way
'asset' => Roots\Acorn\Assets\View\BladeDirective::class,
],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment