panique / mini3 Goto Github PK
View Code? Open in Web Editor NEWJust an extremely simple naked PHP application, useful for small projects and quick prototypes.
Just an extremely simple naked PHP application, useful for small projects and quick prototypes.
Hello,
I tried to create a subfolder on the Controller folder but I do not think it's possible for now to do this?
I declared the namespace with the subfolder, but could not call my controller from a url, or I do not know how.
Thank you
When I use $query->fetchAll(PDO::FETCH_ASSOC) it show this error Fatal error: Uncaught Error: Class 'Mini\Model\PDO' not found ... thats the only thing i changed in the framework
i've got error when
$query = $this->db->prepare($sales);
$query->execute();
$salesid = $query->lastInsertId();
Fatal error: Uncaught Error: Call to undefined method PDOStatement::lastInsertId() in ......
Hi, is it possible, to create urls like /home/edit-song?
In application/Model/Song.php
it's missing
use Mvc\Libs\Helper;
Correct it this:
<?php
/**
* Class Songs
* This is a demo Model class.
*
* Please note:
* Don't use the same name for class and method, as this might trigger an (unintended) __construct of the class.
* This is really weird behaviour, but documented here: http://php.net/manual/en/language.oop5.decon.php
*
*/
namespace Mini\Model;
use Mini\Core\Model;
use Mvc\Libs\Helper;
class Song extends Model
Hi,
I'm getting error below, please check out... and teach me
Fatal error: Uncaught Error: Class 'master\Model\Helper' not found in C:\xampp\htdocs\master\application\Model\User.php:17 Stack trace: #0 C:\xampp\htdocs\master\application\Controller\UserController.php(17): master\Model\User->register('anurag', 'Sinha', 'dev.sinha14@gma...', 's', '1231231231', '9891289891', '9891289891 9891...', 'anurag', 'female', '9891289891', '110092') #1 C:\xampp\htdocs\master\application\Core\Application.php(47): master\Controller\UserController->register() #2 C:\xampp\htdocs\master\public\index.php(37): master\Core\Application->__construct() #3 {main} thrown in C:\xampp\htdocs\master\application\Model\User.php on line 17
When i want to print debug
// useful for debugging: you can see the SQL behind above construction by using:
echo '[ PDO DEBUG ]: ' . Helper::debugPDO($sql, $parameters); exit();
Regards
Anurag
I found a rather interesting error. I'm from Germany and we have often umlauts in our words. In one case I was working on a backend system and was trying to call a page like this:
header('Location: ' . URL . 'controller/action/' . urlencode('somethingWithAnUmlaut'));
And it worked very well, with one exception: the umlaut was removed in the URL and the parameter in the action function. After some digging I found the responsible code for it:
mini3/application/Core/Application.php
Line 75 in 72891a8
MINI seems to decode the URL after catching it (didn't looked up where this happens), so the URL isn't coded in HTTP at that line anymore. Unfortunately the filter used in that line removes all umlauts and some other German special characters (e.c. ß). In my case I just commented the line out. But that's of course not a long term solution. Any ideas here?
P.S.: I really love this 'framework'. Great work to all, who toke the effort making this project this awesome.
Hey panic ! when editing a song with a random (doesn't exists id) it breaks the script and returns an error i think this should be solved :) thanks
Dear friends,
Thank you so much for Mini3.
I have developed many apps using this tool and they all work without issues on my local machine. When I upload the files however to the internet, all my Ajax calls to controller functions return 404 error not found.
for example, I make a call to "home/login", this works fine on my local machine but returns 404 error on my live server.
What might be the issue please?
Like the title says, I've got a database class with a lot of database functions in it like connecting, updating, inserting, get last inserted id etc.
Right now in mini3 the PDO database connection is made inside the core Model.php but because I need those database class for more applications I want to include a external database class.
So I was wondering what the best method is for this 'framework' how to include a Database.php class according to the mini3 namespaces?
You don't want to redirect to another URL if you expect a 404. There is no 404 response code and it's not very common to redirect.
Normal behavior: just show a 404 page on the current URL.
My suggestion:
Change https://github.com/panique/mini3/blob/master/application/Core/Application.php#L55 and https://github.com/panique/mini3/blob/master/application/Core/Application.php#L59 to:
$this->url_controller = new \Mini\Controller\ErrorController();
$this->url_controller->notFound();
And change https://github.com/panique/mini3/blob/master/application/Controller/ErrorController.php#L20 to notFound
.
Then I will be able to set a customised error page for a 404. Direct access to /error
should be blocked.
This pull was applied to the MASTER branch, but not the DEVELOP branch.
The pull is a fantastic feature, and it makes sense that the DEVELOP branch should have it as well.
If there's something I'm missing, please let me know as I can't figure out why it wasn't applied to both....
hello ,
i am using your framework for small website project but i want folder structure like
view(folder) -> contact(folder) -> services(folder) -> our-services.php (file)
when i am trying to using folder inside folder structure i am not able to return view file i am getting error page
in laravel you can create folder inside folder and so on , its really helpful for manage purpose and seo purpose
please resove that or add that access to views also , otherwise framework is really great for small scale project
Hi
First of all thanks for creating beautiful app. Really a good example to kick start for a basic core php application. I always like to code in core due to small size and keep only required code pieces.
You have user namespaces in a very good manner I always stuck with them.
Can you please use some router library like klein https://github.com/klein/klein.php . I have used it and is a good library.
I have a problem with the app I have started php server in the root directory. App is working fine but routing is not working. urls are updating in the address bar but content remains the same.
Please try to use any router that will be very good practice. Also Klein router has built in template renderer to use partials layouts and yield content etc.
I know we always love our child. Its really great, but there is always the scope of improvements.
Thank you in advance.
Rana
Hi everyone,
I am having the same issue that was mentioned at issue #17
Fatal error: Uncaught Error: Class 'Mini\Core\Application' not found in /lab/mini3/public/index.php:37 Stack trace: #0 {main} thrown in lab/mini3/public/index.php on line 37
I didn't modify any file.
Let me know how it was solved.
Could be a matter related to mod_rewrite directive?
From now, thanks!
either it's so easy to do or no body have deployed a mini3 on heroku yet , can't find an issue open no stackpverflow solutions or questions kinda weird but however I'm trying to deploy to heroku and am getting an issue with the routing and finding the index page in public file and getting some other errors as well but it looks like if can get a sample for a Procfile that needed with heroku cause that seems to be the issue and why heroku can't find where to route !
Thanks again for Mini3 it's amazing
Ali Bayati
Hi,
I'm hitting below URL i can view the below data
https://localhost/rest-api/songs/loginStats/Administrator/Anurag/yug
[{"first_name":"Yug","last_name":"Sinha","token":"3242746237678236578346","roll":"Administrator","last_login":"2020-04-02 00:34:41","user_type":"Administrator"}]
When i'm requesting using Angular 8 I'm getting error only
const headers = new HttpHeaders()
.append('Content-Type', 'application/json')
.append('Access-Control-Allow-Headers', 'Content-Type')
.append('Access-Control-Allow-Methods', 'GET')
.append('Access-Control-Allow-Origin', '*');
return this.http.post(${environment.apiUrl}/songs/loginStats
, { usertype,username, password },{headers: headers})
.pipe(map(user => {
payload parameter not coming in function
Regards
Anurag
Please where can i register my route?
The apache rewrite would fail with a 403 error without Options +SymLinksIfOwnerMatch
in the .htaccess
file.
Ubuntu 16.04.3 LTS
Apache 2.4.18
Hello community,
I have only recently started working with Mini and cannot send and then process the data transmitted via a form.
Can someone help me set up this script?
thank you in advance.
I'm just getting into using Mini3 MVC framework but am struggling with the concept of where to code a function that is to be used by ALL views. Can anyone help me? Thanks in advance
Bug?
I send Post Http javascript to controller/model and i get content of index
Edit: long time, disable cache of browser and solve
I changed the name of the folder libs to Libs to make it load. I have the correct namespace is my helper.php : namespace Mini\Libs and I call it like this : \Mini\Libs\Helper::debugPDO() (I know I need the params but that's not the problem).
Error : Fatal error: Uncaught Error: Class 'Mini\Libs\Helper' not found in
I want to use dompdf, I installed it via composer.
I did
use Dompdf\Dompdf;
in top of the Controller and used it like the example says:
$dompdf = new Dompdf();
$dompdf->loadHtml('hello world');
$dompdf->setPaper('A4', 'landscape');
$dompdf->render();
$dompdf->stream();
The browser cannot open the pdf, the error occurs only in PHP Mini framework, I tried it in a separate project and it worked without problems. Do you have any ideas?
Hi, i having problem like class finding error. I had everything worked on my local server but the remote server is failing.
"Fatal error: Class 'Mini\Core\Application' not found in /home/askothersn/public_html/public/index.php on line 37"
Am i have to run composer at remote server also ?
Both php version is 5.6
I not got call a new folder into of controller folder and use.
I will tries put it when me have time or whether you could make it
Is it posible to use blade with Mini3 ?
If someone has multiple parameters:
eg: http://example.com/controller/method/param1/param2/param3/
Then call_user_func_array only allows one parameter to be passed to the method ("param1") as a string.
Replacing 'call_user_func_array' with 'call_user_func' on line 44 of Application.php will enable the user to have multiple parameters sent as an array.
Given the line in the splitUrl function:
$this->url_params = array_values($url);
One can only assume that passing parameters as an array was always the intention? Or am I mistaken (My php is intermediate at best...so I might be missing something here..)
Hi,
Thank you for your good application.
I create a fork and make changes. Works with mysql and postgresql whitout problems.
It's not working for me
Fatal error: Uncaught Error: Class 'Mini\Core\Application' not found in C:\xampp\htdocs\demo\public\index.php:39 Stack trace: #0 {main} thrown in C:\xampp\htdocs\demo\public\index.php on line 39
Directory path
C:\xampp\htdocs\demo\application\Core
Dear friends,
Thank you very much for Mini, it helps a lot for the beginners.
I was going to try Mini3, but have got only errors :(
On php 5.6:
Fatal error: Class 'Mini\Core\Application' not found in .../.../mini3-master/public/index.php on line 37
On php 7.0:
Uncaught Error: Stack trace: #0 {main} thrown in .../.../mini3-master/public/index.php on line 37
namespace Mini\Controller;
use Mini\Libs\Tools\Guard;
use Twilio\Rest\Client;
class HomeController
{
public function __construct()
{
Guard::guard();
}
public function index()
{
$twilio = new Client(TWILIO_SID, TWILIO_TOKEN);
$message = $twilio->messages
->create("whatsapp:+55650000", // to
[
"from" => "whatsapp:+14155238886",
"body" => "Twilio Sandbox: ✅ Hello customer Naelson!",
]
);
print($message->sid);
require APP . 'view/_templates/header.php';
require APP . 'view/index.php';
require APP . 'view/_templates/footer.php';
}
}
Warning: Use of undefined constant CURLOPT_URL - assumed 'CURLOPT_URL' (this will throw an Error in a future version of PHP) in /var/www/html/crm-2wins/vendor/twilio/sdk/src/Twilio/Http/CurlClient.php on line 115
Hi everyone,
When HomeController is called, is executed three "require" statements:
require APP . 'view/_templates/header.php';
require APP . 'view/index.php';
require APP . 'view/_templates/footer.php';
Inside the 'view/index.php' file, there is this statement:
<div w3-include-html="http:<?php echo URL; ?>Mini/view/landpage/formSuscripcion.html"></div>
The 'w3-include-html' tag works -> more reference at: https://www.w3schools.com/howto/howto_html_include.asp
When MIni3 loads this line, shows an error. How could I load that 'formSuscripcion.html' file?
Let me know if you have encountered my issue.
Any help would be welcome.
Best regards.
Do I have to require the lib/helpers.php file in index.php or is is autoloaded?
If autoloaded how can I call a helper function?
Hi, Why i cant upload files images
Warning: move_uploaded_file(): Unable to move 'E:\xampp\tmp\php5FB5.tmp' to '//localhost/mini3/public/uploads/deering.jpg' in E:\xampp\htdocs\mini3\application\view\home\index.php on line 51
where to load data from database to access it from all controllers without reloading it every time ?
I am loading the data from the home controller construct and using other functions to load other views, I don't want to fetch the data every time from database, I want a class where am sure it's gonna run one time only and I can access the data from home controller !
When loading bootstrap files in my css or js files, I get the error page returned in my browser. I'm guessing this is because only my public folder is requestable, how do I solve this?
What is the best way to integrate a login system in MINI3?
Implementing login check and permission check on a Base Controller class that execute db querys using a User model?
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.