1. Go to this page and download the library: Download ismaxim/terminator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ismaxim / terminator example snippets
use Winkill\Winkill;
nkill();
$processes = $winkill->scan();
// Get scanned processes
$scanned = $processes->get();
dd($scanned);
// Kill specific process(es)
$killed = $processes->where(
attribute: 'process_id',
compareAs: '=',
value: 11492
)->kill();
// Note: If the processes have been killed or not found
// by the where-condition then returns an empty array.
dd($killed);
$processes->where('process_name', '=', 'chrome')->kill();
$processes->where('process_id', '=', 11455)->kill();
//❗Alert: killing process(es) by attribute [session_name]
// may break you 🤯 and/or your computer 💥. Use it only
// if you are 100% confident at the ending result.
$processes->where('session_name', '=', 'console')->kill();
//❗Alert: killing process(es) by attribute [session_number]
// is the same danger as was said previously about attribute
// [session_name], so be warned about using it at your risk.
$processes->where('session_number', '=', 1)->kill();
// ⚠️ Note: consumed memory is estimated in Kb(kilobytes)
$processes->where('consumed_memory', '=', 128920)->kill();
// Terminate processes by an array of process names (all names are an example)
array_walk($processes_names = ['chrome', 'firefox', 'slack'],
static fn(string $process_name): Process =>
$processes->where('process_name', '=', $process_name)->kill(),
);
// Terminate processes by an array of process ids (all ids are an example)
array_walk($processes_ids = [1000, 5595, 17820],
static fn(string $process_id): Process =>
$processes->where('process_id', '=', $process_id)->kill(),
);
// You can switch between array_walk and array_map for your needs.
// [Confusing in difference?](https://stackoverflow.com/a/3432266/11591375)
$processes = $processes->where('consumed_memory', '<', 1000)->get();
// Sort processes on consumed memory by ASC
usort($processes, static fn(Process $process, Process $_process): int =>
$process->consumed_memory <=> $_process->consumed_memory
);
// Sort processes on consumed memory by DESC
usort($processes, static fn(Process $process, Process $_process): int =>
$_process->consumed_memory <=> $process->consumed_memory
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.