Defining Custom URL in MacBook for laravel - laravel

I just migrated from a windows based laptop to a macbook.
I'm pretty new to MacOS
I'm developing a laravel project in my mac and I want to access the url through custom domain using virtual host such as mylaravel.com or something else, i'm not using xampp, only php, and composer.
for example:
currently I access my laravel project through:
sudo php artisan serve --port=80
and this is the url to access my
localhost
what I want is the following url:
mylaravel.id
How can I achieve it?
Thank you.

you can use laravel valet.
look at this documentation.

Related

make laravel homestead site public without using third party services

I want to access my laravel homestead site from anywhere in the world without using third party services.I would like to know how I can do that.please help me
You might use ngrok, which is already part of Homestead, to make your site or APIs public.
I recommend deploying on laravel forge using the optimal package. It's quite affordable.
Or alternatively you might play with laravel vapor.

laravel 5.8 routes not working in xampp after update?

i have a pc and desktop, they both used to have xampp and laravel 5.7, recently i updated laravel to 5.8 in my desktop and reset laptop and install laravel 5.8,, routes are working all fine in desktop laravel version ,, but in newly installed laravel in laptop they aren't working, i get 404 error except '/' i tried override all, ifmodule solution they are all fine it is not working in newly installed laravel 5.8 please help ...
PS : i also created seprate project in desktop and laptop ,, not copy paste but individually created in both of them..
i checked apache hhtp.config for ifmodule and overrride and htaccess is default i haven't modified any and is same as all them in solution
i want to be able to use routes without using php artisan serve
Check the configuration of the Directory section in the vhost settings of xampp.

Laravel not working on remote server only test echo working

I am newbie to Laravel and first time setup the laravel app on remote server, I install laravel and configure with domain name by apache config but I am getting blank page on hitting url, For test I just echo test on public/index.php and its showing correctly but welcome page doesn't work, I don't know where I am making mistake.
This is fresh laravel app I have install directly on server
The question was vague.
Have you configure the route.php to your view welcome.blade.php

Laravel version: 5.4.28 api routes not working on localhost

I downloaded Laravel 5.4.28 and created one api route. Nothing works on localhost. I am using XAMPP on Windows 8.1 as local development.
But everything is working fine on server. I also notice one strange thing. It will work on localhost if I create virtual host on localhost. like below.
php artisan serve
Is that true? or Am I missing anything?
My api routes are like this...
http://localhost:1234/adminapi/public/api/v1/authenticateuser
If your XAMPP works normally with normal PHP pages, did you check which version of php XAMPP uses ? the minimum required version is
PHP >= 5.6.4
Laravel Official Website
The default version of XAMPP's PHP framework is 5.6.30
I have faced the same problem, it turned out that I had only problem with PHP version I just upgraded the version of php.ini from 5.6.3 to 7.0.1 new versions of XAMPP have them both !
First of all you need to create virtual host for your project like yourprojectname.local. and test your app through this url.If you not create virtualhost then you need to give whole path for access laravel api like localhost/yourprojectdirectory/public/adminapi/public/api/v1/authenticateuser
You can bellow link refer to the creating virtual host
http://foundationphp.com/tutorials/apache_vhosts.php
OR
How To Set Up Apache Virtual Hosts on XAMPP (Windows)
When you do php artisan serve and load the URL returned by that command do you see laravels welcome page? If not then you haven't installed it correctly. https://laravel.com/docs/5.4
The php artisan serve command doesn't create a virtual host, it is just a shortcut for the PHP Builtin Webserver, something PHP has out of the box, so the point of using it is to start testing your application as fast as you could, you just need to install PHP, Composer and your application is up (if you don't need anything else, of course). But if you already have Nginx installed, there is no point at all, just use it.
It's not wise to use the Builtin Webserver in production.
There's a property in config/app.php called url.
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
By default it links to .env file's property called APP_URL. XAMP usually requires you to navigate to localhost/project_folder before you can even access your project, hence why you need to set your url property to the one you're using.
Second, API routes usually are prefixed with /api/ and do require a X-REQUESTED-WITH: XMLHttpRequest header.
If you install fresh laravel app, you base api prefix must be equal api.
you route in api.php
Route::get('test', 'TestController#test');
If now you run php artisan serve command, api will be available to
localhost:8000/api/test.
Hope, I help you.
I was facing the same with Apache on Windows. Following the next steps below, it worked for me.
First, look for your file httpd.conf into Apache.
Find the section...
<Directory /var/www/>
Change
AllowOverride None
to
AllowOverride All
Finally, restart the Apache service.

Symfony2 dev environment not clearing cache automatically

I'm working on a new Symfony2 project, and I'm using the app_dev frontcontroller to view the default AcmeDemoBundle's pages.
When I make changes to the controllers, I get an exception (NotFoundHttpException: No route found for "GET /demo/hello/World"). If I clear the cache using php app/console cache:clear, things work great again. However, it is my understanding that by using the app_dev front controller, I shouldn't be required to do this. Am I doing something wrong?
Soms system specs:
OSX Lion using MAMP
PHP 5.3.6
Symfony 2.0.1
Are you using different users for webserver and command line user? Maybe you should check for permissions in the Setting up Permissions paragraph.

Resources