Repository navigation
Installation & Usage
xRefCore is a simple framework to create PHP CLI applications. It has some tools which could may help you to create your application, such as multithreading, HTTP-server, asynchronous tasks, pseudo GUI and etc.
xRefCoreCompiler builds the application from your source code.
- PHP 7.4 or above
- Installed and enabled
socketsextension - Parameter
phar.readonlyis Off
Download script-installer (install.ps1 for Windows (PowerShell), install.sh for Linux) from repository. Run script. It will download, install and configure xRefCoreCompiler.
-
PHP was not found. It means that script can't recognize
phpcommand.Solution for Windows
Addphp.exeto your Path variable. If you don't know how, google for "windows add exe to path variable". Then opencmd.exeand inputphp -v. If you did everything right, you will see something like that:PHP 7.4.11 (cli) (built: Sep 29 2020 13:18:06) ( ZTS Visual C++ 2017 x64 ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend TechnologiesSolution for Linux
99% that there is no/usr/bin/phpbinary file. You have to create symlink/usr/bin/phpto/path/to/your/phpor just move it. Then check itphp -v -
I have two or more installed PHP version, but script is using default PHP
Solution for Windows
No solution yet.Solution for Linux
Just run installation script and specify desired PHP-version. Example:./install.sh --php /usr/bin/php7.4. -
I can't use
xrefcore-compiler --prepare-projecton WindowsExplanation
Because of a Windows security policy, you are not allowed to create symlinks in non-administrator mode. xRefCoreCompiler creates a symblink to the xRefCore API in your PhpStorm project for prompts. If you are not using PhpStorm, but, for example, you are using a simple text editor, you may not read the solution to the problem.Solution
There is a three ways:
1. If you're using PhpStorm, just launch it with admin privileges.
2. Allow users to create symlinks in Windows Security Policy Settings. But unfortunately, this will not have an effect on administrative accounts. They will still be able to create character links only in Administrator mode
3. Add flag to runphp.exealways in Admin-mode viaregedit. Google forwindows 10 run exe always as administrator regedit.
4. Create in project a batch file, write to it this:cd C:\path\to\your\projects\ProjectName xrefcore-compiler --prepare-project...and run it as Administrator.
-
I run
xrefcore-compiler --prepare-project, but it creates an invalid symlink.
Go to your home directory. If there is no.xRefCoreCompilerfolder (pay attention on dot in folder name), then create it, runxrefcore-compiler --configure. Go to your project, delete an invalid symlink and tryxrefcore-compiler --prepare-projectagain.
- Create PhpStorm project (in this tutorial we're created project
MyFirstApp) - Open PhpStorm Terminal and run this command
xrefcore-compiler --prepare-project(in Windows you may have some issues. Check above). It will create Main class and symlink to xRefCore API. RUN THIS COMMAND ONLY ONCE WHEN YOUR PROJECT JUST CREATED!!! - Now in your project is another one folder
MyFirstApp. We need to move into it. Inputcd MyFirstAppin your terminal. - Start your coding in
Program/Main.php - Build your application. Use
xrefcore-compiler --build. At first build, you have to fill application data, then save it to your project
https://www.youtube.com/watch?v=7ymvlF0MSYA
on xrefcore.ru
https://github.com/mamayadesu/xRefCore/wiki/xRefCore-Examples