Re: laravel/php

Ashley Sheridan <[email protected]> Thu, 1 Aug 2024 15:13:38 +0100
Newsgroups gmane.comp.php.general
Message-ID <[email protected]>
On 01/08/2024 13:18, bruce wrote:
> Thanks Ashley/list!
>
> Laravel with its own "language" projects/packages/etc. I'm sure
> there's a well thought out structure to it all!
>
> As with anything. In order to really use it, you usually need to get
> acclimated to some extent with the setup.
>
> thanks
>
>
> On Thu, Aug 1, 2024 at 6:37 AM Ashley Sheridan<[email protected]>  wrote:
>>
>> On 31/07/2024 04:32, bruce wrote:
>>
>> Hi Ashley.
>>
>> That's what I thought/tried. Which is why I can't understand what i'm
>> screwing up, to generate the err.
>>
>> My steps
>>    download the github code/repos into the test dir
>>     ---https://github.com/jijunair/laravel-referral
>>
>>    /var/www/html/jijunair
>>      CHANGELOG.md
>>      CODE_OF_CONDUCT.md
>>      CONTRIBUTING.md
>>      LICENSE
>>      README.md
>>      SECURITY.md
>>      composer.json
>>      composer.lock
>>      config
>>      database
>>      images
>>      routes
>>      src
>>      tests
>>      vendor
>>
>>      and trying
>>      cd jijunair/
>>      sudo -u www-data composer require jijunair/laravel-referral
>>          Root package 'jijunair/laravel-referral' cannot require itself
>> in its composer.json
>>
>> per the github repos/page--
>>
>> Installation::
>>    You can install the package via Composer by running the following command:
>>       composer require jijunair/laravel-referral
>>
>> thoughts/comment?
>>
>> thanks..
>>
>> ps. I see this in a number of test sites... so I'm missing something.
>>
>> On Tue, Jul 30, 2024 at 9:24 PM Ashley Sheridan
>> <[email protected]>  wrote:
>>
>>
>> On 31 July 2024 02:07:17 BST, bruce<[email protected]>  wrote:
>>
>> Hi.
>>
>> Is the list ok to post basic laravel questions? Or only straight php?
>>
>> I'm doing some basic research on laravel, and other tech/stacks.
>>
>> For laravel, assume I download a test app from github, and install it in:
>> /var/www/html/asciisd
>>
>> I do a
>>   composer install
>>
>> The "install/setup" says I should do a
>>
>> composer require asciisd/referrals-laravel
>>
>> as well.
>>
>> Should this be done while within the " /var/www/html/asciisd" or in
>> the parent dir " /var/www/html"
>>
>> doing this from the inner dir, gets an err
>>     Root package 'asciisd/referrals-laravel' cannot require itself in
>> its composer.json
>>
>> I'm currently looking over github code samples, as well as numerous vids..
>>
>> thanks
>>
>> It should be done in the same directory as the composer.json file. If you think about it, it makes sense, as that's the config for your composer install.
>>
>> Couple of things, please reply to the list, not directly back to me so that everyone benefits, also try not to top post, but leave replies at the bottom, as per the rules of this list.
>>
>> Now, onto your issue. I think what you may be doing is cloning this repository down separately, and then trying to require it within itself. The instructions in that repo could be clearer, but if you look at the first line in the readme installation instructions, it mentions that this is a package, and in Laravel parlance, that's something you include into an already existing Laravel website. Think of it a bit like a library. So, from within your separate Laravel website that you have set up, run the `composer require` line, which will install this package, and then you can use it to generate your referral codes. Thanks, Ash
>>
>> Ashley Sheridan
>> https://www.ashleysheridan.co.uk

This isn't specific to Laravel (although this particular package seems 
to be), but more related to how the Composer system works to pull in 
various packages into a project.

Laravel does have its own way of doing things, but generally they're 
following best practices that you might find in other frameworks and 
other languages. They have great documentation though.

Ashley Sheridan
https://www.ashleysheridan.co.uk