-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Started Issue #29
Comments
Hey there, I'll proof and provide a solution :) I'l create a working example and fix typo. You may be would need to add an .htaccess-file:
Best regards, |
Hi Marco, Really appreciate the response. I already had a simple .htaccess w/url rewrite:
It still doesn't work. Even tried replacing it with yours, I still get:
I'm thinking if it's an issue with namespacing, maybe a I hope this can be resolved as I really wish to play around with your framework, it looks very good and modular! Good to see this project is still alive by the way! Good work! Edit: Sorry, accidentally closed the topic. |
Hey, I've released a new version 2.3.0 including an example (please see I hope this is helping you! If not, feel free to reopen this repository 😉 Best regards, Marco Bunge |
Ran the update with composer, and tried the sample code in |
Wamp or XAMPP? Or a custom PHP + Apache solution? I'll check as soon as possible! |
XAMP; phpinfo() details:
I've tried with
And also tried with a And my directory structure is:
Let me know if you need additional details. Thanks! |
Hi Marco, any luck so far? |
i just tested this. The Problem is your URL, if you use xampp, the htdocs folder contains your projects. lets say you created a project "hawkbitApplication" so you open URL http://localhost/hawkbitApplication/ now you .htacess kicks in and redirect everything to index.php inside the folder. The Path of the Request Class is now "/hawkbitApplication/" so you need to write $app->get('/hawkbitApplication/',fuction..) as your first URL. To make it work like in the example of public directory, you need to create virtual hosts on xampp which points to xampp/htdocs/hawkbitApplication/web also after creating the virtual host you need to modify your windows hosts file and add a domain on your pc. Please google "Xampp Virtual hosts" The easiest solution would be, don't use Apache from Xampp. Create a "server-start.bat" file in your Project with following code then just double click the bat file and open localhost and you will see "Hello World" if you need apache from Xampp, then change the Port in the bat file to 8080 for example and to run this application you need to open localhost:8080 if you want to use xampp apache you use then just localhost any question? @mbunge league/route/src/Dispatcher.php line 34 $request->getUri()->getPath() contains the project folder instead of / and since there is no route for project folder, he get not found exception. Maybe you can reacto to the NotFoundException with better error Reporting? Not just using their "Not found" Message but instead "Route to /url with method GET" not found or something like this |
@BlackScorp I wasn't able to completely follow your instructions, thus unable to replicate the process that made it work for you. In any case, the whole point of having a framework is that it should be easy to get started with, and if it's not, it defeats the purpose. Maybe it's something that needs to be worked on? |
ok this will be a long answer :D because there is no short version. A Framework means that you have a "frame" where you work within, means that this package deliver classes for you and you have to use them their way. The classes are router, event dispatcher, dependency injection etc, you will need them for 99% of applications. The purpose of the Framework is not getting started quick, but having basic classes which you can use instead of writing them every time again and again for every project. Now regarding the public folder. If you fail here, you will fail with any framework, on laravel you have to start the php server as well, see https://laravel.com/docs/5.4 "Local Development Server" on Symfony you have the same http://symfony.com/doc/current/setup.html#running-the-symfony-application Now you thinking, why do all the frameworks do this? The Web is working like this: You create Request to a Server IP the application on the Server is waiting for a Request on Port 80 if it gets the Request, it try to response, for example if you request a CSS the Server will just return the CSS file, how ever for PHP Files it asks the Interpreter to handle the file and return the interpreters output. There were several cases in the past where this interpreter communication failed, due to bad server setup or ther things. If the websever does not know that it has to ask the interpreter, it will just display the php files as plain text. And you dont want to show your code via browser to others;) Also frameworks like Symfony or Laravel has their configurations stored in .yaml files, which are text files. So anyone who know the path to the file, could potentially read the database username and password. by having a "web" folder or "public" if this happens, only the index.php is shown but it contians usually an include the a bootstrap file one level higher. Now to your Problem you told that is your directory structure +-- vendor lets stick with it, put the .htaccess file into web folder and create in your project folder a "server-start.bat" so now you directory looks like this +-- vendor now edit the file with any text editor, this is the code https://pastebin.com/cntf1stz this code assumes that your xampp is installed in C:\xampp if not, then change the path. Now make sure that in your XAMPP Controll panel, the apache server is disabled. Then just double click on the server-start.bat and open http://localhost Its easy ;) |
@BlackScorp Thank you for the reply, I really appreciate it. While I'm no stranger to frameworks, and definitely not a newbie, what I meant was, it needs to work right out of the box. I have tried Lumen and Slim (which are also microframeworks, and lumen is the scaled down version of Laravel) and they work out of the box. They just weren't what I was looking for. Hawkbit seemed like a much better built and structured framework, which is why I'm eager to try it, but I'm having a hard time setting it up. And what I meant was, ease-of-use / ease-of-setup needs to be a big factor in any sort of framework because one has to build on top of it, just because it isn't a norm, doesn't mean it can't be worked into Hawkbit. I mean if most of my time is spent trying to figure out hacks to make it work, then it defeats the whole purpose. Now, I gather it may be an XAMPP-specific issue, but again, if we could understand why it was happening, maybe we could update the code in Hawkbit, such that it works right out of the box. And I did try your suggestion with the bat file, it still doesn't work. |
@designcise how could Lumen work right out of the box? https://lumen.laravel.com/docs/5.4 see "Serving Your Application" its the same thing. Every framework work this way, so if youre no stranger to frameworks, you should be able to run this. What my suggested batch file is doing, just calling within cmd.exe C:\xampp\php\php.exe -S 0.0.0.0:80 -t <path where .bat file is located>web and if this is not working, then none framework will work. Or you used something different for Lumen/Slim than xampp Here https://www.slimframework.com/docs/tutorial/first-app.html "Run Your Application With PHP’s Webserver" shame on all the PHP Frameworks which cannot name their headers for linking |
@BlackScorp gosh I meant obviously, worked as in worked out-of-box following the instructions, and in the environment I have. And no, I did not use anything different for Slim or Lumen, it works with composer + xampp easily by following the docs, whereas the same is not true for Hawkbit. |
@designcise but all the instruction says, use composer create project, then call php -S localhost:somePort -t public please show me the instruction which worked for you out of the box and i will translate it to hawkbit |
I never called "php -S localhost:somePort -t public" on lumen; I use composer, for example |
just tested out, youre right, Hawkbit is using Zend Request class while lumen use Symfony Request class. it seems. Inside the phpleague router in the Dispatcher the Request Path is used like this $request->getUri()->getPath() in Lumen this path is modified while in Zend Request it is not. In Lumen this works because of the bootstrap/app.php the new instance of the application is recieving the base path where the project is located, and base on this, they remove some parts from the request URL so the router is working @mbunge all you need is that $app->getRequest()->getUri()->getPath() will return / if you call http://localhost/myProject/web/ |
@designcise i created a pull request, after the merge, it will work "out of the box" cheers |
@BlackScorp yep, that seems to work! You may want to remove double semi-colons at the end of line 188. Thanks a bunch for helping on this. |
@designcise strange, i did it here https://github.com/BlackScorp/hawkbit/commit/47bbefe9c5d30ac4faed7e3e7cf79de0ae05d90f but the PR dont have it |
@BlackScorp I just applied the change in Application.php as it appears here: https://github.com/BlackScorp/hawkbit/commit/a711c23ff1034648be4600dec076bcdca64aba51 and it seems to have resolved the issue. Edit: Sorry, totally slipped my mind you were talking about the double semi-colon issue I pointed out. Sorry, it's almost 6 am here, need to get some sleep! |
@designcise everything is good:D lets see if @mbunge accepts my PR cheers |
@mbunge can you please test/accept the PR by @BlackScorp as it resolves the issue, thanks! |
Hello @BlackScorp and @designcise, I had a huge workload. Thank you for PR, I already approved and merged it! Have a look new special thanks section in readme ;) I published a new Version 2.3.1 |
i just changed like 3 lines of code :P |
@mbunge Since there isn't a platform where we can discuss this, I'm going to ask this here, I hope you find the time to reply: So, the Hawkbit framework is very good, but I want to know:
Sorry, I'm just asking to assess what the future holds for the framework before implementing it into my projects. I would love to contribute to it in the future, but it's important to know how things are presently. Thank you for your time! I really appreciate it! |
@designcise I've open a new issue #33 for your questions :) |
I'm following the docs:
But that code returns:
Fatal error: Class 'Hawkbit\Application\Application' not found in D:\Work\web\index.php on line 5
Removing "\Application" works (so it must mean there's a typo in the docs), but this presents the following issue:
Any help would be greatly appreciated! Here's my composer.json:
The text was updated successfully, but these errors were encountered: