Working with php files using webpack - php

I'm working on project using React on client side and PHP on server. I'm building client using webpack but my problem is that I'm not sure what's the right way to "import" .php files. I want to post to them using axios, so I need to know their place in my project structure. But if I run "webpack" my files will land in /dist folder. For example from component the path to php file would be "../../dist/php/getItem.php" but after webpacking it will change.......
How can I make some kind of special folder for php files, that would be available for me before as well as after building my components? I've found "file-loader" for webpack but I can't find any example of using it for php files.
I hope I explained my problem

Related

Laravel routing intercepts all requests to js files etc

I'm new to Laravel and I've been having a few problems setting up the dev environment for Laravel.
I'm using the Built in PHP web server on windows. Which I've started either with:
php artisan serve
or
php -S localhost:8000 server.php
I'm basically trying to get css and js served correctly, unfortunately the Laravel routing seems to be getting in the way. I initially rewrote the server.php file to not run on requests ending in .js, css etc.
However this requires me to suffix any src URLs with public which is not really sensible.
I've seen quite a few tutorials about how Laravel Elixir writes the SASS and minified js files to the public folder which looks perfectly fine but I can't get past this routing issue.
What am I missing? I've seen very few details about this so not sure what I've done wrong here.
Note I'm trying to get this working so a dev team can use this so ideally I'd like to avoid complex aliases etc. Which could easily be setup in a live environment but in a team it becomes painful and I can imagine people being tempted to hack the server.php file or similar horrors.
Thanks,

the phonegap directory structure in apache php

I am sorry for this such question as I am still a fresh beginner in Phonegap.
I have followed some tutorial both for the installation and the jquery.mobile usage.
There are some parts (the biggest part) that I am confused with this Phonegap. And it is about the directory structure.
I am working with Private PHP Framework from my department, that is why I used Lamp Stack for all of this.
However, with the Phonegap tutorials I have been following this far, it looks like it have a little bit different environment structure from usual. It have five default directory as follows:
Hook
platforms
Plugins
www
In where the working directory for this Phonegap must be in the www directory.
It makes me afraid because our Apache Environment require us to put the directory in costume folder (Not in var/www), and then also the PHP Framework require us to put the module in a specific folder.
Please, I just need an enlightment for this Phonegap, how do you access the files and where do you guys put it.
Many thanks in advance.
As requested:
Create another vhost that points to www. You don't need to worry about hook, platform and plugins which are cordova/phonegap folders. Let them all at the same level (don't change the structure, just point the vhost to www).
The structure of cordova/phonegap is simple. Inside the www folder will be all your programming logic to build yours mobile app.
But beware, the cordova/phonegap does not compile code in PHP, it just uses a webview (like a browser) to run your mobile application developed with HTML, CSS and Javascript, packaged in a apk with access to native features of the smartphone/tablet, basically.
To make your application to communicate to the server in php you have two alternatives:
1) Making your app to access a URL that points to the application
developed with PHP and render its application in webview.
2) Create all purely on HTML, CSS and Javascript and make
communication via ajax, or socket or something similar to the server.

run independent .php inside laravel framework

I recently installed laravel framework in my laptop.I installed laravel in my Xampp server's htdocs/laravel/laravel source path
How can I run execute written PHP codes normally in browsers and run execute them out side laravel framework?
That means if I create a new .php file in desktop that will show "hello world". Where I should keep that file or in which folder to show my this individual file run in browser only inside laravel framework.
You can put it inside your public directory. If your application has a domain of localhost you can access it via localhost/script.php. BUT this is extremely ill-advised as you are opening yourself to potential vulnerabilities depending on what your script does.
If it is for testing then fine. Otherwise you will have to put that somewhere in your application say app/scripts/script.php where it cannot be accessed via the browser (the only point of stand-alone scripts in web application is for CRON tasks or for CLI commands). If this is the case, you may want to take a look at http://laravel.com/docs/4.2/commands about writing your own artisan commands.
Simplest solution in make filename.blade.php file.
put it in resources/views/filename.blade.php and execute it using routes routes/web.php
Route::get("/filename", function(){
return view('filename');
});
I would recommend storing that code in a custom library inside of Laravel and including it within a controller.
You can put your PHP file inside your storage/app/public/filename.php folder in your laravel application folder and can run like
your_domain_name/storage/filename.php

How to include file from seperate remote folder in Netbeans (PHP Development)

I have a PHP project setup in Netbeans (v6.8) where all the PHP files are on a remote server and in a single directory. Whenever I save files locally they are updated on the remote server via SFTP.
I now need to edit a remote JavaScript file to add some jQuery logic but the file is located within a different directory on the webserver. How to I add this JavaScript file such that when it is saved or updated it is transferred to it's own location on the server?
When I attempt to create the file locally within NetBeans it saves to the same directory as my PHP files. I would like to be able to continue using NetBeans rather than doing this all manually using an SFTP client and a text editor. Thanks in advance.
Since you're not getting any answers I'll offer a limited suggestion. I use netbeans, but not to automatically upload like you're doing so I may be way off here.
It sounds like you would either need to change your project to have a larger directory structure that would contain everything for this to work like you want it to. Gan you go up a level or two in the directory structure, and add containing folders in your local project to match?
The other option might be to create a second project for the javascript directory, and set that to go were it needs to go. You can create "project groups" in the project view which you can use to link them together. I know this is probably not ideal, but is hopefully easier than doing your uploads manually.

How to Handle Multiple Projects in CodeIgniter?

When coding in Visual Studio, I can have multiple website projects, and I'm able to switch between them by opening each website project on the local drive. I'm confused at how CodeIgniter handles this operation in Visual Studio. It seems the programming environment is the actual install location. How do I start to code a new website while preserving the code of the previous one? Is there a script to package a project, export the package, and then import it later?
Codeigniter's documentation walks you through managing multiple applications with one installation
As noted in the link above, after structuring your application folder,
Each of your applications will need
its own index.php file which calls the
desired application.
I would like to further explain that after you have duplicated the index.php file you will need to go into your base directories .htaccess file and add a few new rewrite statements to the file.
I have previously taken my application/controllers folder and added subdirectories for each application. The controller routing would have to reflect these changes.

Categories