Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit b88db3a

Browse files
author
Andrés Correa Casablanca
committed
Add support to run Jupyter-PHP as a library
1 parent 80b7db1 commit b88db3a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/kernel.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,21 @@
1212

1313
namespace Litipk\JupyterPHP;
1414

15+
define(
16+
'PATH_TO_VENDOR_AS_LIBRARY',
17+
__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'
18+
);
1519

16-
require (__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php');
20+
define(
21+
'PATH_TO_VENDOR_AS_PROJECT',
22+
__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor'
23+
);
24+
25+
$pathToVendor = file_exists(PATH_TO_VENDOR_AS_LIBRARY)
26+
? PATH_TO_VENDOR_AS_LIBRARY
27+
: PATH_TO_VENDOR_AS_PROJECT;
28+
29+
require ($pathToVendor . DIRECTORY_SEPARATOR . 'autoload.php');
1730

1831

1932
use Litipk\JupyterPHP\System\System;

0 commit comments

Comments
 (0)