passwalls / mark Goto Github PK
View Code? Open in Web Editor NEWMark is a high performance API micro framework based on workerman helps you quickly write APIs with php
Mark is a high performance API micro framework based on workerman helps you quickly write APIs with php
Hi,
I'm trying to bind the app to hostname, so I can have two instances of the app on the same IP and same port, but on different hostnames.
Service starts ok, but when I visit the domain I get Connection Refused by browser. Binding to IP works fine. How can I debug, or is it possible at all?
Thanks
how can I call a synchronous function or wait for a response using mark?
my current code is as follows (is messy due to attempts)
I would like to know how do I "testsql" send data for the first return
(sorry for opening a doubt here but I had already given up looking for her)
<?php
use Mark\App;
use Workerman\Connection\AsyncTcpConnection;
require 'vendor/autoload.php';
//---------------------API -------------------//
$api = new App('http://0.0.0.0:3030');
$api->count = 4;
$api->any('/', function ($requst) {
return testesql();
});
function testesql()
{
$sql_connection = new AsyncTcpConnection('Text://127.0.0.1:1234');
$sql_connection->connect();
$sql_connection->send('SELECT titulo FROM perguntas WHERE id = 2');
$teste = '';
$sql_connection->onMessage = function($sql_connection, $sql_result) use ($teste)
{
var_dump($sql_result);
return ($sql_result);
};
var_dump("me chamam primeiro");
return json_decode($teste);
}
$api->start();
How is ssl enabled in this framework?
I've seen just get and post methods, how about put/patch/delete?
public function get($path, $callback);
public function post($path, $callback);
public function any($path, $callback);
From nikic/FastRoute docs:
For the GET, POST, PUT, PATCH, DELETE and HEAD request methods shortcut methods are available.
Is it just a missing implementation in marks base methods?
Will there be an ability to make nested routes?
example:
$api->with('/book/{id}', function ($request) {
$api->any('/read', function ($requst) {
return 'Hello world';
});
$api->any('/delete', function ($requst) {
return 'Delete book stub';
});
});
Hi,
How do I add security token authentication to the REST API I develop with mark. Is there some sample code, documentation or tutorial. If there is any other alternative method to secure the API, kindly share.
Thanks
Amal
composer required mark/mark 有问题
直接git clone
作者考虑参加FrameworkBenchmarks吗,这是一个比较全面的测试
https://github.com/TechEmpower/FrameworkBenchmarks
案例可以找到workerman 的案例操作 和webman
It'd be nice to have an ability to pass any PSR-15 compatible dispatcher from this list https://github.com/middlewares/awesome-psr15-middlewares#dispatcher and keep using by default FastRoute\simpleDispatcher
It will let people to use middlewares
How complex can regex get in the route vars?
Sorry for this but this is NOT a framework at all.
Is just a wrapper around workerman for 6 methods.
I was expecting more honestly.
Dont want to hurt anyones feelings with this either.
Hi, I'm trying to do a benchmark test using Apache bench but it gives me this error. It would appear that it won't close the connection and I wouldn't know how to fix it, thanks for the help
hi! Is Xdebug supposed to work?
I can debug other PHP applications including CLI ones with XDebug on Windows 10 but mark doesn't seem to work.
Example code:
<?php
require 'vendor/autoload.php';
use Mark\App;
$api = new App('http://0.0.0.0:3000'); // Xdebug breakpoint here works
$api->count = 1;
$api->any('/', function ($requst) {
return 'Hello world'; // Xdebug breakpoint here doesn't work
});
$api->start();
$api = new App('http://0.0.0.0:3000');
$api->count = 4; // process count
Benchmark with ab is not working
Benchmarking 127.0.0.1 (be patient)...apr_pollset_poll: The timeout specified has expired (70007)
It's there's any option for access local static files ?
for rendering Images, css, js ?
Hi, doing direct benchmarks on the machine with Mark the speed is remarkable, but if I pass my connection through an api gateway with openresty doing the benchmark the speed drops a lot and I would like to understand how to improve it.
Hi @passwalls
We're targeting a framework with an ORM (MySQL, Redis) and support for Json, Protobuf, and REST/Websocket.
Only building micro services.
Mark seems a bit stripped. We are not sure how to proceed. Do we use external libraries for ORM? Recommend something?
What do you recommend?
add $app->get($request,$response,..,)
For better handling in some programming we detect Header Content-type json,
I did add header('Content-Type: application/json');
but still don't work
Hi, thanks for your work.
I'm not a workerman user so my apologies for such a simple question.
In your post example, $requst returns a huge object: how to retrieve the body payload? I've already looked at workerman docs but it's not clear either.
I noticed mark is #1 in benchmark at the moment so I want to benchmark it with a slightly different json rest test (I'm pretty impressed in their test it overclasses go, which can be compiled).
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.