jane/runtime
Deprecated package. jane/runtime has moved to the janephp/janephp monorepo. Use https://github.com/janephp/janephp for the current runtime and related components; this repository is no longer maintained.
Verify Necessity:
jane/runtime is absolutely required for your Laravel app. Given its deprecated status, audit dependencies to identify alternatives (e.g., Symfony components, Laravel’s built-in tools).composer why jane/runtime
to trace usage in your project.Isolation Setup:
// config/app.php
'providers' => [
App\Providers\JaneRuntimeProvider::class,
],
// app/Providers/JaneRuntimeProvider.php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Jane\Runtime\Runtime;
class JaneRuntimeProvider extends ServiceProvider
{
public function register()
{
$this->app->singleton('jane.runtime', function () {
return new Runtime();
});
}
}
First Use Case:
use Illuminate\Support\Facades\App;
$runtime = App::make('jane.runtime');
$result = $runtime->execute(storage_path('workflows/test.yaml'));
$pointer = new \Jane\Runtime\JsonPointer('/path/to/field');
$data = $pointer->get($jsonArray);
Key Files to Inspect:
vendor/jane/runtime/src/Runtime.php – Core execution logic.vendor/jane/runtime/src/Context.php – State management.vendor/jane/runtime/src/JsonPointer.php – Niche JSON traversal (if used).Service Provider Integration:
// app/Providers/JaneRuntimeProvider.php
public function boot()
{
$this->app->afterResolving('jane.runtime', function ($runtime) {
// Post-registration logic (e.g., default context)
$runtime->setContext(new \Jane\Runtime\Context());
});
}
YAML Workflow Execution:
storage/workflows/ and load dynamically:
public function runWorkflow(string $name, array $params = [])
{
$path = storage_path("workflows/{$name}.yaml");
if (!file_exists($path)) {
throw new \RuntimeException("Workflow {$name} not found.");
}
return app('jane.runtime')->execute($path, $params);
}
Illuminate\Support\Facades\Validator before execution.Context Sharing:
$context = app('jane.runtime')->getContext();
$context->set('user', auth()->user());
Action Extensibility:
$runtime = app('jane.runtime');
$runtime->registerAction('laravel_action', function ($args) {
return Model::where($args['key'], $args['value'])->get();
});
spl_autoload_register or runtime hooks may conflict with Laravel’s autoloader. Use Laravel’s service container instead.dispatch(new ExecuteWorkflowJob($workflowName, $params));
| Jane Feature | Laravel Alternative |
|---|---|
| YAML Parsing | Symfony\Component\Yaml\Yaml::parse() |
| URI Handling | Illuminate\Support\Str::of() or league/uri |
| JSONPointer | Custom implementation or php-json-pointer |
Dependency Conflicts:
Class 'Symfony\Component\Yaml\Yaml' not found.// composer.json
"config": {
"platform-check": false,
"preferred-install": {
"symfony/yaml": "3.1.*"
}
}
symfony/yaml:^6.0.PHP 8.x Incompatibility:
create_function(), array_walk with by-reference, etc.// Before (PHP 7.4+)
$callback = fn($item) => $item * 2;
array_walk($items, $callback);
State Management Issues:
Context class may not play well with Laravel’s dependency injection.$context = app('jane.runtime')->getContext();
$context->set('request_id', request()->id);
No Laravel Facades:
Facade pattern. Workaround:
// Create a facade manually
use Illuminate\Support\Facades\Facade;
class JaneRuntime extends Facade { protected static function getFacadeAccessor() { return 'jane.runtime'; } }
Testing Challenges:
phpunit.xml to override:
<php>
<env name="PHPUNIT_VERSION" value="9.5"/>
</php>
Enable Jane’s Debug Mode:
$runtime = app('jane.runtime');
$runtime->setDebug(true); // Logs workflow execution
Log Workflow Steps:
Jane\Runtime\Context to log actions:
$context = app('jane.runtime')->getContext();
$context->setLogger(app('log'));
Isolate for Testing:
FreshTestCase to reset the container before tests:
public function setUp(): void
{
parent::setUp();
$this->artisan('config:clear');
}
Custom Workflow Steps:
Jane\Runtime\Workflow to add Laravel-specific steps:
class LaravelWorkflow extends \Jane\Runtime\Workflow
{
public function addLaravelStep(string $name, callable $callback)
{
$this->steps[$name] = $callback;
}
}
Replace Serialization:
Serializer. Replace with Laravel’s json_encode() or spatie/laravel-serializable-models:
$runtime = app('jane.runtime');
$runtime->setSerializer(function ($data) {
return json_encode($data, JSON_PRETTY_PRINT);
});
URI Handling:
League\Uri with Laravel’s Illuminate\Support\Str:
$runtime = app('jane.runtime');
$runtime->setUriParser(function ($uri) {
return Str::of($uri)->toArray();
});
No Laravel Config Support:
./workflows/). Override with:
$runtime = app('jane.runtime');
$runtime->setWorkflowDir(storage_path('app/workflows'));
Autoloading Issues:
composer dump-autoload is run after installation.Environment-Specific Behavior:
$_SERVER:
putenv('HTTP_HOST=localhost');
Jane\Runtime in your codebase:
grep -r "Jane\\Runtime" .
symfony/yaml:^6.0league/uri:^6.0 or Illuminate\Support\Strphp-json-pointerHow can I help you explore Laravel packages today?