Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
MEGAMINDMK authored Dec 21, 2019
1 parent 50b9473 commit 08f0000
Show file tree
Hide file tree
Showing 9 changed files with 1,391 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Php Electronjs v0.3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<div align="center">
<a href="https://php.net">
<img
alt="PHP"
src="https://www.php.net/images/logos/new-php-logo.svg"
width="150">
</a><br>
<a href="https://electronjs.org">
<img
alt="electron"
src="https://electronjs.org/images/electron-logo.svg"
width="250">
</a><br>
<img src="https://cdn.discordapp.com/attachments/458308642920333322/656948283377319977/bandicam_2019-12-19_00-57-05-761.jpg" height="300" width="500">
</div>

# PHP-Electronjs
A working php server with electronjs fully customizable &amp; easy to use

# Steps
- npm i
- npm start
- electron-packager .

# Download
<a href="https://github.com/MEGAMINDMK/PHP-Electronjs/releases/download/v0.3/php_electron.exe">Clicky ! v0.3</a>
Binary file added Php Electronjs v0.3/icon.ico
Binary file not shown.
25 changes: 25 additions & 0 deletions Php Electronjs v0.3/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<style>
webview{
width: 100%;
height: 100%;
}
</style>
<body onload="php();">
<webview src="http://localhost/www" autosize="on" webpreferences="nodeIntegration=no,nativeWindowOpen=true" useragent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36" plugins></webview>
</body>
<script>
function php(){
//var myBatFilePath = "start.bat";
//const spawn = require('child_process').spawn;
//const bat = spawn('cmd.exe', ['/c', myBatFilePath]);
const exec = require('child_process').exec;
exec('cd php && call php -S localhost:80', (e, stdout, stderr)=> {
if (e instanceof Error) {
console.error(e);
throw e;
}
console.log('stdout ', stdout);
console.log('stderr ', stderr);
});
}
</script>
41 changes: 41 additions & 0 deletions Php Electronjs v0.3/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const electron = require("electron");
const BrowserWindow = electron.BrowserWindow;
const app = electron.app;
const Menu = electron.Menu;
const MenuItem = electron.MenuItem
let win

function createWindow () {
win = new BrowserWindow({ width: 1000, height: 700, icon: __dirname + '/icon.ico'})
win.setMenu(null)
win.loadFile('index.html')
win.on('closed', () => {
win = null
})
}

app.on('ready', createWindow)

app.on('window-all-closed', () => {
if (process.platform !== 'windows') {
//var myBatFilePath = "stop.bat";
//const spawn = require('child_process').spawn;
//const bat = spawn('cmd.exe', ['/c', myBatFilePath]);
const exec = require('child_process').exec;
exec('taskkill /F /IM php.exe', (e, stdout, stderr)=> {
if (e instanceof Error) {
console.error(e);
throw e;
}
console.log('stdout ', stdout);
console.log('stderr ', stderr);
});
app.quit()
}
})

app.on('activate', () => {
if (win === null) {
createWindow()
}
})
2 changes: 2 additions & 0 deletions Php Electronjs v0.3/node_modules/README.MD

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 08f0000

Please sign in to comment.